Skip to content

Commit

Permalink
deps: quarkus graalvmce build base (#23)
Browse files Browse the repository at this point in the history
* deps: quarkus graalvmce build base

* Chop down build

* Comments and layout

* Simplify Dockerfile, use .dockerignore, comments
  • Loading branch information
DerekRoberts authored Sep 25, 2023
1 parent 4399dd9 commit 85b203f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
7 changes: 7 additions & 0 deletions backend-java/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
target/**
.dockerignore
.gitignore
Dockerfile
mvnw.cmd
*.yml
*.yaml
*.md
34 changes: 16 additions & 18 deletions backend-java/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
FROM quay.io/quarkus/ubi-quarkus-native-image:22.3.0-java17 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 chmod +x mvnw
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
COPY src /code/src
# Quarkus Images
# https://github.com/quarkusio/quarkus-images

# "Provides the native-image executable. Used by the Maven and Gradle plugin from Quarkus to build linux64 executables"
FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:22.3.3-java17 AS build

# Image defaults to /project; copy controlled by .dockerignore
COPY --chown=quarkus:quarkus . ./
RUN ./mvnw package -Pnative -DskipTests
HEALTHCHECK --interval=300s --timeout=30s CMD ./mvnw --version || exit 1
###

# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root --from=build /code/target/*-runner /work/application

# Port and health check
EXPOSE 3000
USER 1001
HEALTHCHECK --interval=300s --timeout=3s CMD curl -f http://localhost:3000/ || exit 1
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

# Startup
COPY --chown=1001:root --from=build /project/target/*-runner /app
USER 1001
CMD ["/app", "-Dquarkus.http.host=0.0.0.0"]

0 comments on commit 85b203f

Please sign in to comment.