-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (29 loc) · 1.31 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (29 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# syntax=docker/dockerfile:1
# ---- Build stage: bundles the bun-built frontend into the backend shadow jar ----
FROM --platform=$BUILDPLATFORM eclipse-temurin:21-jdk-jammy AS build
WORKDIR /app
# Bun is required by the frontend Gradle build (frontend/build.gradle.kts).
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl unzip ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL https://bun.sh/install | bash
ENV BUN_INSTALL=/root/.bun
ENV PATH=/root/.bun/bin:${PATH}
# Copy the whole project (see .dockerignore for exclusions) and build the fat jar.
# The Ktor plugin names the fat jar `backend-all.jar`; normalize it to app.jar.
COPY . .
RUN chmod +x gradlew \
&& ./gradlew :backend:buildFatJar --no-daemon \
&& cp backend/build/libs/backend-all.jar app.jar
# ---- Runtime stage: slim JRE with just the application jar ----
FROM eclipse-temurin:21-jre-jammy AS runtime
WORKDIR /app
RUN groupadd --system app && useradd --system --gid app app
COPY --from=build /app/app.jar app.jar
RUN mkdir -p /app/data && chown -R app:app /app
USER app
EXPOSE 8080
# Persisted state: H2 database file and the repository artifact tree both live here
# (see application.yaml defaults: database.h2.file and repository.storagePath).
VOLUME ["/app/data"]
ENTRYPOINT ["java", "-jar", "app.jar"]