-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.multistage
37 lines (29 loc) · 1.25 KB
/
Dockerfile.multistage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Stage 1 : prepare builder image with java dependencies
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.1-jdk-21 AS deps
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 -e -C org.apache.maven.plugins:maven-dependency-plugin:3.6.1:go-offline quarkus:go-offline
USER root
ARG NODEVER=v20.12.2
## Install nodejs and yarn (via corepack)
RUN curl -L https://nodejs.org/dist/${NODEVER}/node-${NODEVER}-linux-x64.tar.xz -o /tmp/node-${NODEVER}.tar.xz \
&& cd /tmp \
&& tar xvf /tmp/node-${NODEVER}.tar.xz \
&& cp -R /tmp/node-${NODEVER}-linux-x64/* /usr/ \
&& corepack enable
## Stage 2 : copy in code and compile native binary from builder image
FROM deps AS build
USER quarkus
WORKDIR /code
COPY --chown=quarkus:quarkus . /code
ENV QUARKUS_QUINOA_FROZEN_LOCK_FILE=true
RUN ./mvnw -o clean -Dnative package
## Stage 3 : create the docker final image
FROM quay.io/quarkus/quarkus-distroless-image:2.0 AS release
COPY --from=build /code/target/*-runner /application
EXPOSE 8080
USER nonroot
CMD ["/application", "-XX:+PrintGC", "-XX:+PrintGCTimeStamps", "-XX:+VerboseGC", "+XX:+PrintHeapShape", "-Xmx128m", "-Dquarkus.http.host=0.0.0.0"]