mancala/apps/backend/Dockerfile

30 lines
958 B
Docker
Raw Normal View History

# Build from the repo root: docker build -f apps/backend/Dockerfile .
FROM eclipse-temurin:25.0.4_7-jdk-noble AS build
2022-07-09 14:40:56 +03:00
# The Maven wrapper checks the .zip it downloads; without unzip it would fetch a .tar.gz that fails the check.
RUN apt-get update && apt-get install -y --no-install-recommends unzip && rm -rf /var/lib/apt/lists/*
2022-07-09 14:40:56 +03:00
WORKDIR /build
# Dependencies first, so they are cached until the pom changes
COPY apps/backend/.mvn .mvn
COPY apps/backend/mvnw apps/backend/pom.xml ./
RUN ./mvnw -B -q quarkus:go-offline
COPY apps/backend/src src
RUN ./mvnw -B -q package -DskipTests
2022-07-09 14:40:56 +03:00
FROM eclipse-temurin:25.0.4_7-jre-noble
2022-07-09 14:40:56 +03:00
ENV PORT=6000
2022-07-09 14:40:56 +03:00
# The app writes access.log and crashes/ to its working directory.
RUN useradd --system --create-home mancala && install -d -o mancala /home/mancala/app
WORKDIR /home/mancala/app
COPY --from=build --chown=mancala /build/target/quarkus-app/ ./
USER mancala
2022-07-09 14:40:56 +03:00
EXPOSE ${PORT}
CMD ["java", "-jar", "quarkus-run.jar"]