2023-11-23 21:49:14 +01:00
|
|
|
# syntax=docker/dockerfile:1.4.0
|
2023-07-27 00:18:55 +02:00
|
|
|
|
|
|
|
ARG MAVEN_CLI_OPTS="--batch-mode --no-transfer-progress -Dmaven.test.skip"
|
2024-02-18 14:00:45 +01:00
|
|
|
ARG SETUP_IMAGE=setup-image
|
2024-04-13 21:27:43 +02:00
|
|
|
ARG TEMURIN_IMAGE_TAG=22-jdk-alpine
|
2023-07-27 00:18:55 +02:00
|
|
|
|
|
|
|
# Copy all project files
|
2024-02-18 14:00:45 +01:00
|
|
|
FROM docker.io/maven:3.9-eclipse-temurin-21 AS setup-image
|
2023-05-16 01:49:44 +02:00
|
|
|
WORKDIR /app
|
2024-02-17 16:22:16 +01:00
|
|
|
COPY . .
|
2023-07-27 00:18:55 +02:00
|
|
|
RUN --mount=type=cache,target=/root/.m2/ \
|
2024-02-17 16:22:16 +01:00
|
|
|
mvn ${MAVEN_CLI_OPTS} package
|
2023-07-27 00:18:55 +02:00
|
|
|
|
2024-02-18 14:00:45 +01:00
|
|
|
FROM ${SETUP_IMAGE} as setup
|
|
|
|
|
2024-02-17 16:22:16 +01:00
|
|
|
# Create final monolith
|
2024-04-13 21:27:43 +02:00
|
|
|
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS monolith
|
2024-02-17 16:22:16 +01:00
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=setup /app/monolith/target/monolith-*-fat.jar /app/monolith.jar
|
|
|
|
CMD ["java", "-jar", "/app/monolith.jar"]
|
2023-05-16 01:49:44 +02:00
|
|
|
|
2023-07-27 00:18:55 +02:00
|
|
|
# Create final web
|
2024-04-13 21:27:43 +02:00
|
|
|
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS web
|
2023-05-16 01:49:44 +02:00
|
|
|
WORKDIR /app
|
2024-02-17 16:22:16 +01:00
|
|
|
COPY --from=setup /app/web/target/web-*-fat.jar /app/web.jar
|
2023-05-16 01:49:44 +02:00
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["java", "-jar", "/app/web.jar"]
|
|
|
|
|
2023-07-27 00:18:55 +02:00
|
|
|
# Create final migration
|
2024-04-13 21:27:43 +02:00
|
|
|
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS migration
|
2023-05-16 01:49:44 +02:00
|
|
|
WORKDIR /app
|
2024-02-17 16:22:16 +01:00
|
|
|
COPY --from=setup /app/migration/target/migration-*-fat.jar /app/migration.jar
|
2023-05-16 01:49:44 +02:00
|
|
|
CMD ["java", "-jar", "/app/migration.jar"]
|
|
|
|
|
2023-07-27 00:18:55 +02:00
|
|
|
# Create final bot
|
2024-04-13 21:27:43 +02:00
|
|
|
FROM docker.io/eclipse-temurin:${TEMURIN_IMAGE_TAG} AS bot
|
2023-05-16 01:49:44 +02:00
|
|
|
WORKDIR /app
|
2024-02-17 16:22:16 +01:00
|
|
|
COPY --from=setup /app/bot/target/bot-*-fat.jar /app/bot.jar
|
2023-05-16 01:49:44 +02:00
|
|
|
CMD ["java", "-jar", "/app/bot.jar"]
|
2023-11-23 20:49:58 +01:00
|
|
|
|
|
|
|
# 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
|
2023-11-23 21:49:14 +01:00
|
|
|
|
|
|
|
# Create caddy reverse proxy
|
|
|
|
FROM docker.io/caddy AS caddy
|
|
|
|
RUN <<EOF cat > /etc/caddy/Caddyfile
|
2023-12-07 16:36:27 +01:00
|
|
|
{
|
|
|
|
debug
|
|
|
|
auto_https off
|
|
|
|
}
|
|
|
|
|
2023-12-08 20:06:28 +01:00
|
|
|
:8080 {
|
|
|
|
route {
|
2024-02-17 16:22:16 +01:00
|
|
|
reverse_proxy /api/* monolith:8080
|
2023-12-08 20:06:28 +01:00
|
|
|
reverse_proxy ui:80
|
|
|
|
}
|
2023-12-07 16:36:27 +01:00
|
|
|
}
|
2023-11-23 21:49:14 +01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
EXPOSE 8080
|