10
Dockerfile
10
Dockerfile
@@ -1,8 +1,6 @@
|
|||||||
# Stage that builds the application, a prerequisite for the running stage
|
# Stage that builds the application, a prerequisite for the running stage
|
||||||
FROM eclipse-temurin:21-jdk-noble AS build
|
FROM eclipse-temurin:21-jdk-noble AS build
|
||||||
|
|
||||||
ARG SERVICE_ROOT
|
|
||||||
|
|
||||||
RUN apt-get update -qq
|
RUN apt-get update -qq
|
||||||
|
|
||||||
# Stop running as root at this point
|
# Stop running as root at this point
|
||||||
@@ -11,12 +9,10 @@ WORKDIR /usr/src/app/
|
|||||||
RUN chown app:app /usr/src/app/
|
RUN chown app:app /usr/src/app/
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
# Copy pom.xml and prefetch dependencies so a repeated build can continue from the next step with existing dependencies
|
|
||||||
COPY --chown=app ${SERVICE_ROOT}/.mvn/ .mvn
|
|
||||||
COPY --chown=app ${SERVICE_ROOT}/mvnw ${SERVICE_ROOT}/pom.xml ./
|
|
||||||
|
|
||||||
# Copy all needed project files to a folder
|
# Copy all needed project files to a folder
|
||||||
COPY --chown=app:app ${SERVICE_ROOT}/src ./src
|
COPY --chown=app ./.mvn/ .mvn
|
||||||
|
COPY --chown=app ./mvnw ./pom.xml ./
|
||||||
|
COPY --chown=app ./src ./src
|
||||||
|
|
||||||
# Build the production package
|
# Build the production package
|
||||||
RUN ./mvnw --batch-mode clean verify -DskipTests
|
RUN ./mvnw --batch-mode clean verify -DskipTests
|
||||||
|
Reference in New Issue
Block a user