build: replace scaffold Dockerfiles with native multi-stage image
- Add Dockerfile using Mandrel jdk-21 builder and quarkus-micro-image:2.0 runtime - Run as non-root user 1001, expose 8080, set TZ=America/Santiago - Bind http host to 0.0.0.0 for container networking - Remove obsolete Quarkus-generated Dockerfiles (jvm, legacy-jar, native, native-micro) - Tighten .dockerignore to ship only build inputs (mvnw, .mvn, pom.xml, src) - Add api.http with /status and /q/health request samples
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
## Stage 1 : build with maven builder image with native capabilities
|
||||
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21 AS build
|
||||
COPY --chown=quarkus:quarkus mvnw /code/mvnw
|
||||
COPY --chown=quarkus:quarkus .mvn /code/.mvn
|
||||
COPY --chown=quarkus:quarkus pom.xml /code/
|
||||
USER quarkus
|
||||
WORKDIR /code
|
||||
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
|
||||
COPY src /code/src
|
||||
RUN ./mvnw package -Dnative
|
||||
|
||||
## Stage 2 : create the docker final image
|
||||
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
||||
WORKDIR /work/
|
||||
COPY --from=build /code/target/*-runner /work/application
|
||||
|
||||
# set up permissions for user `1001`
|
||||
RUN chmod 775 /work /work/application \
|
||||
&& chown -R 1001 /work \
|
||||
&& chmod -R "g+rwX" /work \
|
||||
&& chown -R 1001:root /work
|
||||
|
||||
EXPOSE 8080
|
||||
USER 1001
|
||||
|
||||
#TimeZone
|
||||
ENV TZ="America/Santiago"
|
||||
|
||||
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
|
||||
Reference in New Issue
Block a user