diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 278abbc569..4e55f1173a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,8 +66,10 @@ jobs: if: ${{ steps.version.outputs.VERSION != '' }} run: | docker buildx create --use - docker buildx build . -t tolgee/tolgee:${{ steps.version.outputs.VERSION }} --platform linux/arm64,linux/amd64 --cache-from type=registry,ref=tolgee/tolgee:latest --cache-to type=inline --push - docker buildx build . -t tolgee/tolgee:latest --platform linux/arm64,linux/amd64 --cache-from type=registry,ref=tolgee/tolgee:latest --cache-to type=inline --push + docker buildx build . -f legacy.Dockerfile -t tolgee/tolgee:${{ steps.version.outputs.VERSION }} --platform linux/arm64,linux/amd64 --cache-from type=registry,ref=tolgee/tolgee:latest --cache-to type=inline --push + docker buildx build . -f legacy.Dockerfile -t tolgee/tolgee:latest --platform linux/arm64,linux/amd64 --cache-from type=registry,ref=tolgee/tolgee:latest --cache-to type=inline --push + docker buildx build . -t tolgee/tolgee:${{ steps.version.outputs.VERSION }}-pg18 --platform linux/arm64,linux/amd64 --cache-from type=registry,ref=tolgee/tolgee:latest --cache-to type=inline --push + docker buildx build . -t tolgee/tolgee:latest-pg18 --platform linux/arm64,linux/amd64 --cache-from type=registry,ref=tolgee/tolgee:latest --cache-to type=inline --push working-directory: build/docker - name: Pack with webapp diff --git a/backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt b/backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt index 80f5572137..54dfac2879 100644 --- a/backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt +++ b/backend/app/src/main/kotlin/io/tolgee/postgresRunners/PostgresDockerRunner.kt @@ -14,7 +14,7 @@ class PostgresDockerRunner( override fun run() { instance = DockerContainerRunner( - image = "postgres:16.3", + image = "postgres:18.0", expose = mapOf(postgresAutostartProperties.port to "5432"), waitForLog = "database system is ready to accept connections", waitForLogTimesForNewContainer = 2, diff --git a/build.gradle b/build.gradle index 1fefb33a9a..30f0f5ecd6 100644 --- a/build.gradle +++ b/build.gradle @@ -103,7 +103,12 @@ project(':server-app').afterEvaluate { commandLine "docker", "rm", "--force", "--volumes", dbSchemaContainerName } exec { - commandLine "docker", "run", "-e", "POSTGRES_PASSWORD=postgres", "-d", "-p55538:5432", "--name", dbSchemaContainerName, "postgres:13" + commandLine "docker", "run", + "-e", "POSTGRES_PASSWORD=postgres", + "-d", + "-p55538:5432", + "--name", dbSchemaContainerName, + "postgres:18.0" } Thread.sleep(5000) } diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index f22e6f7d01..922145c012 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -1,9 +1,18 @@ -FROM postgres:13.21-alpine3.22 +FROM postgres:18.0 ENTRYPOINT [] -RUN apk --no-cache add openjdk21 -RUN apk --no-cache add libxml2 +RUN < /dev/null + echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list + apt -qq update + apt -qq -y install temurin-21-jdk libxml2 + apt -qq -y remove wget --purge --auto-remove + rm -rf /var/lib/apt/lists/* +EOF ############# ### Tolgee # diff --git a/docker/app/legacy.Dockerfile b/docker/app/legacy.Dockerfile new file mode 100644 index 0000000000..69fe0526f4 --- /dev/null +++ b/docker/app/legacy.Dockerfile @@ -0,0 +1,39 @@ +# TODO: remove for Tolgee 4 release +FROM postgres:13.21-alpine3.22 + +ENTRYPOINT [] + +RUN apk --no-cache add openjdk21 +RUN apk --no-cache add libxml2 + +############# +### Tolgee # +############# + +# Expose application port +EXPOSE 8080 + +# Define persistent volume for data storage +VOLUME /data + +# Environment variables for configuration +ENV HEALTHCHECK_PORT=8080 \ + spring_profiles_active=docker + +# Copy necessary application files +COPY BOOT-INF/lib /app/lib +COPY META-INF /app/META-INF +COPY BOOT-INF/classes /app +COPY --chmod=755 cmd.sh /app + +################# +### Let's go ## +################# + +# Define the startup command +ENTRYPOINT ["/app/cmd.sh"] + + +# Health check to ensure the app is up and running +HEALTHCHECK --interval=10s --timeout=3s --retries=20 \ + CMD wget --spider -q "http://127.0.0.1:$HEALTHCHECK_PORT/actuator/health" || exit 1 diff --git a/docker/docker-compose.template.yml b/docker/docker-compose.template.yml index ff1d5a98ea..298329a8a0 100644 --- a/docker/docker-compose.template.yml +++ b/docker/docker-compose.template.yml @@ -1,6 +1,6 @@ services: db: - image: postgres:11 + image: postgres:18.0 environment: - POSTGRES_PASSWORD=postgres app: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3753a3a7c8..a40a4a8f0b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,6 +1,6 @@ services: db: - image: postgres:11 + image: postgres:18.0 volumes: - ../build/db-data:/var/lib/postgresql/data/ environment: @@ -14,4 +14,4 @@ services: depends_on: - "db" smtp: - image: namshi/smtp \ No newline at end of file + image: namshi/smtp diff --git a/gradle/docker.gradle b/gradle/docker.gradle index 6635901e7b..b85671a6be 100644 --- a/gradle/docker.gradle +++ b/gradle/docker.gradle @@ -21,8 +21,12 @@ task docker { doLast { exec { workingDir dockerPath - commandLine "docker", "build", ".", "-t", "tolgee/tolgee", "--cache-from", "type=registry,ref=tolgee/tolgee:latest" + commandLine "docker", "build", ".", "-t", "tolgee/tolgee", "--cache-from", "type=registry,ref=tolgee/tolgee:latest-pg18" } + exec { + workingDir dockerPath + commandLine "docker", "build", ".", "-f", "legacy.Dockerfile", "-t", "tolgee/tolgee", "--cache-from", "type=registry,ref=tolgee/tolgee:latest" + } } dependsOn("dockerPrepare") } @@ -32,13 +36,19 @@ void createDockerBuildxTask(String taskName, boolean isPush) { doLast { if (project.hasProperty('dockerImageTag')) { def commandParams = ["docker", "buildx", "build", ".", "-t", project.property('dockerImageTag'), "--platform", "linux/arm64,linux/amd64"] - if (isPush) { + def commandParamsLegacy = ["docker", "buildx", "build", ".", "-f", "legacy.Dockerfile", "-t", project.property('dockerImageTag') + "-pg18", "--platform", "linux/arm64,linux/amd64"] + if (isPush) { commandParams += ["--push"] + commandParamsLegacy += ["--push"] } - exec { - workingDir dockerPath - commandLine commandParams - } + exec { + workingDir dockerPath + commandLine commandParams + } + exec { + workingDir dockerPath + commandLine commandParamsLegacy + } } else { throw new GradleException('A "dockerImageTag" project property must be defined! e.g. ./gradlew dockerBuildx -PdockerImageTag=myImageTag'); }