Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/java-dev-container.
Something went wrong. Try again.
java-dev-container Dockerfile
1.1 kB · 37 lines
Dockerfile
1234567891011121314151617181920212223242526272829303132333435363738# Stages can be targeted individually by name e.g. docker build --target build-clientFROM maven:eclipse-temurin AS build-serverWORKDIR /app
# Set up dependencies for caching firstCOPY server/pom.xml .COPY server/mvnw .COPY server/.mvn .mvnRUN chmod +x mvnw && ./mvnw -DskipTests dependency:go-offline
# Copy source and buildCOPY server/src srcRUN ./mvnw -DskipTests clean package
# Based on https://pnpm.io/docker#example-3-build-on-cicdFROM node:lts-slim AS build-client
ENV PNPM_HOME="/pnpm"ENV PATH="$PNPM_HOME:$PATH"RUN corepack enable
WORKDIR /appCOPY client/pnpm-lock.yaml .# Fetch is an optimized command for docker build to support caching. --prod is used to avoid installing devDependenciesRUN pnpm fetch --prod
COPY client/ .RUN pnpm build
FROM eclipse-temurin:25.0.2_10-jre-noble AS finalWORKDIR /appCOPY --from=build-server /app/target/*.jar app.jar# Copy the client files and put them in /public to be exposed by spring bootCOPY --from=build-client /app/dist /app/public
EXPOSE 8080ENTRYPOINT ["java", "-jar", "/app/app.jar"]