-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 1.25 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (30 loc) · 1.25 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
39
# SPDX-License-Identifier: Apache-2.0
# BlockPilot Minecraft Panel
# Multi-stage build keeps compilers and frontend tools out of the final image.
FROM node:22-bookworm AS builder
WORKDIR /app
# Copy manifests first so dependency installation can be cached.
COPY package*.json ./
COPY apps/api/package*.json ./apps/api/
COPY apps/web/package*.json ./apps/web/
RUN npm ci
# Build API and frontend from tracked source files.
COPY . .
RUN npm run build && npm prune --omit=dev
FROM node:22-bookworm-slim AS runtime
# Java and tar are required for Minecraft processes and backup archives.
RUN apt-get update \
&& apt-get install -y --no-install-recommends openjdk-21-jre-headless tar \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/api/package*.json ./apps/api/
COPY --from=builder /app/apps/api/dist ./apps/api/dist
COPY --from=builder /app/apps/web/dist ./apps/web/dist
# Keep project and third-party license notices inside distributed container images.
COPY --from=builder /app/LICENSE /app/NOTICE /app/THIRD_PARTY_NOTICES.md ./
RUN mkdir -p /app/runtime /app/Server
EXPOSE 8787 25565
CMD ["node", "apps/api/dist/index.js"]