-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
50 lines (35 loc) · 1.14 KB
/
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
42
43
44
45
46
47
48
49
50
# Base image for both builder and runner
FROM node:latest AS base
# Install ffmpeg, sox
RUN apt-get update && \
apt-get install -y ffmpeg sox && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Enable pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Builder stage
FROM base AS builder
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the project files
COPY . .
# Build the TypeScript code to JavaScript
RUN pnpm run build
# Final runtime image
FROM base
# Set the working directory inside the container
WORKDIR /usr/src/app
# Copy the package.json and pnpm-lock.yaml files from the builder image
COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./
# Copy the built JavaScript files from the builder image
COPY --from=builder /usr/src/app/dist ./dist
# Install production dependencies
RUN pnpm install --prod --frozen-lockfile
# Expose the port your application listens on
EXPOSE 8080
# Start the application
CMD ["node", "dist/server.js"]