-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (35 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
51 lines (35 loc) · 1.03 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
40
41
42
43
44
45
46
47
48
49
50
51
# Use Node.js 20 Alpine as base image
FROM node:20-alpine AS base
# Install pnpm and build dependencies for native modules
RUN apk add --no-cache python3 make g++ && npm install -g pnpm
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# Build the Next.js app
RUN pnpm run build
# Production stage
FROM node:20-alpine AS production
# Install pnpm and build dependencies for native modules
RUN apk add --no-cache dumb-init python3 make g++ && npm install -g pnpm
# Create app directory
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Copy built app from build stage
COPY --from=base /app/.next/standalone ./
# Create data directory for SQLite database
RUN mkdir -p /app/data
# Expose port
EXPOSE 3456
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3456
# Use dumb-init to handle signals properly
ENTRYPOINT ["dumb-init", "--"]
# Start the application
CMD ["node", "server.js"]