-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 800 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (25 loc) · 800 Bytes
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
# Use Alpine variant for better Docker compatibility
FROM node:18-alpine
# Set environment variables to handle threading issues
ENV PORT=80
ENV UV_THREADPOOL_SIZE=4
ENV NODE_OPTIONS="--max-old-space-size=4096"
WORKDIR /usr/src/app
# Install dependencies first for better caching
COPY package*.json ./
# Use safer npm install flags to avoid threading issues
RUN npm ci --no-audit --no-fund
# Install PM2 globally
RUN npm install pm2 -g
# Copy application code
COPY . .
# Build the application
RUN npm run build
# Copy views and public directories to match the compiled structure
RUN cp -r views lib/views
RUN cp -r public lib/public
# Clean up dev dependencies after build
RUN npm ci --only=production --no-audit --no-fund
# Expose port
EXPOSE 80
CMD ["pm2-runtime", "ecosystem.config.js"]