Added Docker workflow
All checks were successful
Build & Push Docker Image / build-and-push (push) Successful in 6m23s
All checks were successful
Build & Push Docker Image / build-and-push (push) Successful in 6m23s
This commit is contained in:
47
Dockerfile
Normal file
47
Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
||||
# ─── Stage 1: Install dependencies ───────────────────────────────────────────
|
||||
FROM oven/bun:1 AS deps
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
# ─── Stage 2: Build Next.js ──────────────────────────────────────────────────
|
||||
FROM oven/bun:1 AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
RUN bun run build
|
||||
|
||||
# ─── Stage 3: Production runner ──────────────────────────────────────────────
|
||||
FROM oven/bun:1-slim AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Copy runtime dependencies
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Copy Next.js build output
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Copy server entry point and all runtime source files
|
||||
COPY --from=builder /app/server.ts ./server.ts
|
||||
COPY --from=builder /app/lib ./lib
|
||||
COPY --from=builder /app/drizzle ./drizzle
|
||||
COPY --from=builder /app/tsconfig.json ./tsconfig.json
|
||||
COPY --from=builder /app/next.config.ts ./next.config.ts
|
||||
|
||||
# Pre-create data directory (SQLite db + uploads land here)
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# Volumes for persistent data
|
||||
# Mount your Minecraft server directory to /mc-server
|
||||
# Mount your backups directory to /backups
|
||||
VOLUME ["/app/data", "/mc-server", "/backups"]
|
||||
|
||||
CMD ["bun", "--bun", "run", "server.ts"]
|
||||
Reference in New Issue
Block a user