dchat/Dockerfile
Augusto Dwenger J. 76f96becff
All checks were successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
ci/woodpecker/push/cleanup Pipeline was successful
ci/woodpecker/tag/java/1 Pipeline was successful
ci/woodpecker/tag/java/2 Pipeline was successful
ci/woodpecker/tag/java/3 Pipeline was successful
ci/woodpecker/tag/java/4 Pipeline was successful
ci/woodpecker/tag/java/5 Pipeline was successful
ci/woodpecker/tag/nodejs Pipeline was successful
ci/woodpecker/tag/oci-image-cache-build Pipeline was successful
ci/woodpecker/tag/oci-image-build/1 Pipeline was successful
ci/woodpecker/tag/oci-image-build/2 Pipeline was successful
ci/woodpecker/tag/oci-image-build/3 Pipeline was successful
ci/woodpecker/tag/oci-image-build/4 Pipeline was successful
ci/woodpecker/tag/oci-image-build/5 Pipeline was successful
ci/woodpecker/tag/cleanup Pipeline was successful
build: Update runtime Java version to 22
This change also changes the base image, to be based of Alpine instead
of Ubuntu.
2024-04-13 21:27:43 +02:00

69 lines
1.7 KiB
Docker

# syntax=docker/dockerfile:1.4.0
ARG MAVEN_CLI_OPTS="--batch-mode --no-transfer-progress -Dmaven.test.skip"
ARG SETUP_IMAGE=setup-image
ARG TEMURIN_IMAGE_TAG=22-jdk-alpine
# Copy all project files
FROM docker.io/maven:3.9-eclipse-temurin-21 AS setup-image
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/root/.m2/ \
mvn ${MAVEN_CLI_OPTS} package
FROM ${SETUP_IMAGE} as setup
# Create final monolith
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS monolith
WORKDIR /app
COPY --from=setup /app/monolith/target/monolith-*-fat.jar /app/monolith.jar
CMD ["java", "-jar", "/app/monolith.jar"]
# Create final web
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS web
WORKDIR /app
COPY --from=setup /app/web/target/web-*-fat.jar /app/web.jar
EXPOSE 8080
CMD ["java", "-jar", "/app/web.jar"]
# Create final migration
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS migration
WORKDIR /app
COPY --from=setup /app/migration/target/migration-*-fat.jar /app/migration.jar
CMD ["java", "-jar", "/app/migration.jar"]
# Create final bot
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS bot
WORKDIR /app
COPY --from=setup /app/bot/target/bot-*-fat.jar /app/bot.jar
CMD ["java", "-jar", "/app/bot.jar"]
# Build the ui
FROM docker.io/node:18-alpine AS ui-build
WORKDIR /ui
COPY ui/package.json ui/package-lock.json .
RUN npm ci
COPY ui .
RUN npm run build
# Create final ui
FROM docker.io/nginx AS ui
COPY --from=ui-build ui/dist /usr/share/nginx/html
# Create caddy reverse proxy
FROM docker.io/caddy AS caddy
RUN <<EOF cat > /etc/caddy/Caddyfile
{
debug
auto_https off
}
:8080 {
route {
reverse_proxy /api/* monolith:8080
reverse_proxy ui:80
}
}
EOF
EXPOSE 8080