-
-
Notifications
You must be signed in to change notification settings - Fork 314
feat: Optimize Dockerfile #3193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
306b7fe
52a59cf
b389e38
e2bc38a
dfe0234
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| FROM eclipse-temurin:21-alpine | ||
|
|
||
| RUN apk --no-cache add libxml2 bash | ||
|
|
||
| ############# | ||
| ### 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 | ||
|
Comment on lines
+33
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Healthcheck may fail on Alpine due to wget availability/flags; prefer curl. Alpine’s base often has BusyBox wget with limited flags (e.g., --spider may be unsupported). Install curl and use it in HEALTHCHECK to avoid false negatives. Apply this diff: -RUN apk --no-cache add libxml2 bash
+RUN apk --no-cache add curl ca-certificates
@@
-HEALTHCHECK --interval=10s --timeout=3s --retries=20 \
- CMD wget --spider -q "http://127.0.0.1:$HEALTHCHECK_PORT/actuator/health" || exit 1
+HEALTHCHECK --interval=10s --timeout=3s --retries=20 \
+ CMD curl -fsS "http://127.0.0.1:${HEALTHCHECK_PORT}/actuator/health" >/dev/null || exit 1
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/usr/bin/env bash | ||
| #!/bin/sh | ||
|
|
||
| ARCH=`uname -m` | ||
| if [ "$ARCH" = "aarch64" ]; then | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the canonical Spring Boot env var name.
Spring reads SPRING_PROFILES_ACTIVE; lower-case spring_profiles_active won’t be picked up by relaxed binding.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents