containerize app for production
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -0,0 +1,35 @@
|
|||||||
|
# =====================
|
||||||
|
# Build Stage
|
||||||
|
# =====================
|
||||||
|
FROM oven/bun:1.2.10-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
COPY package.json bun.lock ./
|
||||||
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
|
# Copy rest of app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build Next.js app
|
||||||
|
RUN bun run build
|
||||||
|
|
||||||
|
# =====================
|
||||||
|
# Runtime Stage
|
||||||
|
# =====================
|
||||||
|
FROM oven/bun:1.2.10-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy only necessary files from builder
|
||||||
|
COPY --from=builder /app/package.json /app/package.json
|
||||||
|
COPY --from=builder /app/.next /app/.next
|
||||||
|
COPY --from=builder /app/public /app/public
|
||||||
|
COPY --from=builder /app/node_modules /app/node_modules
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Run in production
|
||||||
|
CMD ["bun", "run", "start"]
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
ical-pwa:
|
||||||
|
build: .
|
||||||
|
container_name: ical-pwa
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
NODE_ENV: production
|
||||||
|
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
- /app/node_modules
|
||||||
|
|||||||
Reference in New Issue
Block a user