Skip to content

Commit fabd161

Browse files
committed
build: introduce -pg18 docker builds to not cause breaking changes yet
1 parent df2fe08 commit fabd161

File tree

3 files changed

+59
-8
lines changed

3 files changed

+59
-8
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ jobs:
6666
if: ${{ steps.version.outputs.VERSION != '' }}
6767
run: |
6868
docker buildx create --use
69-
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
70-
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
69+
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
70+
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
71+
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
72+
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
7173
working-directory: build/docker
7274

7375
- name: Pack with webapp

docker/app/legacy.Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# TODO: remove for Tolgee 4 release
2+
FROM postgres:13.21-alpine3.22
3+
4+
ENTRYPOINT []
5+
6+
RUN apk --no-cache add openjdk21
7+
RUN apk --no-cache add libxml2
8+
9+
#############
10+
### Tolgee #
11+
#############
12+
13+
# Expose application port
14+
EXPOSE 8080
15+
16+
# Define persistent volume for data storage
17+
VOLUME /data
18+
19+
# Environment variables for configuration
20+
ENV HEALTHCHECK_PORT=8080 \
21+
spring_profiles_active=docker
22+
23+
# Copy necessary application files
24+
COPY BOOT-INF/lib /app/lib
25+
COPY META-INF /app/META-INF
26+
COPY BOOT-INF/classes /app
27+
COPY --chmod=755 cmd.sh /app
28+
29+
#################
30+
### Let's go ##
31+
#################
32+
33+
# Define the startup command
34+
ENTRYPOINT ["/app/cmd.sh"]
35+
36+
37+
# Health check to ensure the app is up and running
38+
HEALTHCHECK --interval=10s --timeout=3s --retries=20 \
39+
CMD wget --spider -q "http://127.0.0.1:$HEALTHCHECK_PORT/actuator/health" || exit 1

gradle/docker.gradle

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ task docker {
2121
doLast {
2222
exec {
2323
workingDir dockerPath
24-
commandLine "docker", "build", ".", "-t", "tolgee/tolgee", "--cache-from", "type=registry,ref=tolgee/tolgee:latest"
24+
commandLine "docker", "build", ".", "-t", "tolgee/tolgee", "--cache-from", "type=registry,ref=tolgee/tolgee:latest-pg18"
2525
}
26+
exec {
27+
workingDir dockerPath
28+
commandLine "docker", "build", ".", "-f", "legacy.Dockerfile", "-t", "tolgee/tolgee", "--cache-from", "type=registry,ref=tolgee/tolgee:latest"
29+
}
2630
}
2731
dependsOn("dockerPrepare")
2832
}
@@ -32,13 +36,19 @@ void createDockerBuildxTask(String taskName, boolean isPush) {
3236
doLast {
3337
if (project.hasProperty('dockerImageTag')) {
3438
def commandParams = ["docker", "buildx", "build", ".", "-t", project.property('dockerImageTag'), "--platform", "linux/arm64,linux/amd64"]
35-
if (isPush) {
39+
def commandParamsLegacy = ["docker", "buildx", "build", ".", "-f", "legacy.Dockerfile", "-t", project.property('dockerImageTag') + "-pg18", "--platform", "linux/arm64,linux/amd64"]
40+
if (isPush) {
3641
commandParams += ["--push"]
42+
commandParamsLegacy += ["--push"]
3743
}
38-
exec {
39-
workingDir dockerPath
40-
commandLine commandParams
41-
}
44+
exec {
45+
workingDir dockerPath
46+
commandLine commandParams
47+
}
48+
exec {
49+
workingDir dockerPath
50+
commandLine commandParamsLegacy
51+
}
4252
} else {
4353
throw new GradleException('A "dockerImageTag" project property must be defined! e.g. ./gradlew dockerBuildx -PdockerImageTag=myImageTag');
4454
}

0 commit comments

Comments
 (0)