-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 880 Bytes
/
Dockerfile
File metadata and controls
33 lines (25 loc) · 880 Bytes
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
# Stage 1: Frontend build
FROM oven/bun:latest AS frontend
WORKDIR /app/frontend
COPY frontend/package.json frontend/bun.lock ./
RUN bun install --frozen-lockfile
COPY frontend/ .
RUN bun run build
# Stage 2: Backend build
FROM gradle:8.13-jdk21 AS backend
WORKDIR /app
COPY build.gradle.kts settings.gradle.kts gradle.properties ./
COPY src/ src/
COPY --from=frontend /app/frontend/../src/main/resources/static src/main/resources/static
RUN gradle bootJar --no-daemon -x buildFrontend -x test
# Stage 3: Runtime
FROM eclipse-temurin:21-jre
WORKDIR /app
RUN groupadd -r snaplake && useradd -r -g snaplake snaplake
RUN mkdir -p /app/data && chown -R snaplake:snaplake /app
COPY --from=backend --chown=snaplake:snaplake /app/build/libs/*.jar snaplake.jar
USER snaplake
EXPOSE 8080
VOLUME /app/data
ENV SNAPLAKE_DATA_DIR=/app/data
ENTRYPOINT ["java", "-jar", "snaplake.jar"]