-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (44 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
60 lines (44 loc) · 1.06 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
52
53
54
55
56
57
58
59
60
# Build stage
FROM node:20-slim AS builder
# Install SQLite dependencies
RUN apt-get update && apt-get install -y \
python3 \
make \
g++ \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy project files
COPY . .
# Build the application
RUN npm run build
# Production stage
FROM node:20-slim
# Install SQLite dependencies
RUN apt-get update && apt-get install -y \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package files and install production dependencies
COPY package*.json ./
RUN npm ci --omit=dev
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
COPY server.js .
COPY src/lib/serverLogger.js ./src/lib/serverLogger.js
# Create directories for database and logs
RUN mkdir -p db logs
# Set environment variables
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000
# Create volume for persistent data
VOLUME ["/app/db", "/app/logs"]
# Expose port
EXPOSE 3000
# Start the server
CMD ["node", "server.js"]