diff options
| author | Kevin Hoerr <kjhoerr@protonmail.com> | 2023-12-02 22:27:11 -0500 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2025-08-18 11:52:26 -0400 |
| commit | 14df4838427c281122b7e12f6a7c87de843c01fd (patch) | |
| tree | 6d1bc32126c5e312beb5896204a62a854c40fb8b | |
| parent | ce033991002c9b4356693edfa64d6549c36ec0ed (diff) | |
| download | pantry-14df4838427c281122b7e12f6a7c87de843c01fd.tar.gz pantry-14df4838427c281122b7e12f6a7c87de843c01fd.tar.bz2 pantry-14df4838427c281122b7e12f6a7c87de843c01fd.zip | |
Multistage updates (#268)
* Dockerfile.multistage: temporary
* Dockerfile.multistage: add stage for holding maven dependencies and node/yarn
| -rw-r--r-- | src/main/docker/Dockerfile.multistage | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/main/docker/Dockerfile.multistage b/src/main/docker/Dockerfile.multistage index 8505c80..1cb3436 100644 --- a/src/main/docker/Dockerfile.multistage +++ b/src/main/docker/Dockerfile.multistage @@ -1,16 +1,32 @@ -## Stage 1 : build with maven builder image with native capabilities - Quinoa will bake in the front-end -FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:23.1-jdk-21 AS build +## 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 +## Install nodejs and yarn (via corepack) +RUN curl -L https://nodejs.org/dist/v20.10.0/node-v20.10.0-linux-x64.tar.xz -o /tmp/node-v20.10.0.tar.xz \ + && cd /tmp \ + && tar xvf /tmp/node-v20.10.0.tar.xz \ + && cp -R /tmp/node-v20.10.0-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 -RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline -ENV QUARKUS_QUINOA_PACKAGE_MANAGER_INSTALL=true QUARKUS_QUINOA_PACKAGE_MANAGER_INSTALL_NODE_VERSION=18.13.0 COPY --chown=quarkus:quarkus . /code -RUN ./mvnw -Pnative clean package -## Stage 2 : create the docker final image +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 |
