-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (28 loc) · 744 Bytes
/
Dockerfile
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
# Build stage
FROM node:18-alpine AS build
WORKDIR /usr/src/app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
# Copy source files
COPY . .
# Run stage
FROM node:18-alpine
# Set non-root user
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
WORKDIR /usr/src/app
# Install ffmpeg
RUN apk add --no-cache ffmpeg
# Copy built node modules and source files
COPY --from=build --chown=nodejs:nodejs /usr/src/app/node_modules ./node_modules
COPY --from=build --chown=nodejs:nodejs /usr/src/app .
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
# Expose port
EXPOSE $PORT
# Switch to non-root user
USER nodejs
# Start the application
CMD ["node", "src/server.js"]