forked from slopus/happy-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 1.13 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
# Stage 1: Building the application
FROM node:20 AS builder
# Install dependencies
RUN apt-get update && apt-get install -y python3 ffmpeg make g++ build-essential && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy package.json and yarn.lock
COPY package.json yarn.lock ./
COPY ./prisma ./prisma
# Install dependencies
RUN yarn install --frozen-lockfile --ignore-engines
# Copy the rest of the application code
COPY ./tsconfig.json ./tsconfig.json
COPY ./vitest.config.ts ./vitest.config.ts
COPY ./sources ./sources
# Build the Next.js application
RUN yarn build
# Stage 2: Runtime
FROM node:20 AS runner
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y python3 ffmpeg && rm -rf /var/lib/apt/lists/*
# Set environment to production
ENV NODE_ENV=production
# Copy necessary files from the builder stage
COPY --from=builder /app/tsconfig.json ./tsconfig.json
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/sources ./sources
# Expose the port the app will run on
EXPOSE 3000
# Command to run the application
CMD ["yarn", "start"]