mancala/apps/backend/Dockerfile
Halit Aksoy 6aeff37eb8 feat(backend): replace the Node backend with the Quarkus backend
The Quarkus project moves to apps/backend and the Express sources go.
The image is built from the repo root as before, with Temurin 25, and
runs as a non-root user on port 6000. Compose passes the database as a
JDBC URL with the same MANCALA_DB_PASSWORD.
2026-10-16 11:47:40 +03:00

30 lines
958 B
Docker

# Build from the repo root: docker build -f apps/backend/Dockerfile .
FROM eclipse-temurin:25.0.4_7-jdk-noble AS build
# 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/*
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
FROM eclipse-temurin:25.0.4_7-jre-noble
ENV PORT=6000
# 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
EXPOSE ${PORT}
CMD ["java", "-jar", "quarkus-run.jar"]