-
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.06 KB
/
Dockerfile
File metadata and controls
51 lines (35 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
# Stage 1: Build
FROM node:20-alpine3.21 AS build
WORKDIR /app
ENV NODE_ENV=production
# Install build dependencies
RUN apk add --no-cache \
python3 make g++ cairo-dev pango-dev jpeg-dev giflib-dev
# Install TypeScript globally
RUN npm install -g typescript
# Copy package.json and package-lock.json
COPY package.json package-lock.json /app/
# Install dependencies
RUN npm install
# Copy the rest of the application
COPY . /app
# Build the application
RUN npm run build
# Remove dev dependencies and cache
RUN npm prune --production && npm cache clean --force
# Stage 2: Final
FROM node:20-alpine3.21
WORKDIR /app
ENV NODE_ENV=production
# Install runtime dependencies for canvas
RUN apk add --no-cache \
cairo pango giflib libjpeg \
font-noto
# Copy only the necessary files from the build stage
COPY --from=build /app/dist /app/dist
COPY --from=build /app/package.json /app/package-lock.json /app/
COPY --from=build /app/node_modules /app/node_modules
# Expose the application port
EXPOSE 1542
# Command to run the application
CMD ["node", "./dist/index.js"]