-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (32 loc) · 937 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
42
43
44
45
46
47
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Corepack enable
RUN corepack enable yarn
# Copy package.json and package-lock.json (if exists)
COPY package.json yarn.lock .yarn* tsconfig.json ./
# Install dependencies
RUN yarn install
# Copy the rest of the application code
COPY ./src ./src
COPY ./public ./public
# Build the application
RUN yarn build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Corepack enable
RUN corepack enable yarn
# Node environment
ENV NODE_ENV=production
# Copy built assets from the builder stage
COPY --from=builder /app/package.json /app/yarn.lock /app/.yarn* ./
# Install only production dependencies
RUN yarn workspaces focus --production
# Copy public and dist directories from the builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/public ./public
# Expose the port your app runs on
EXPOSE 3000
# Start the application
CMD ["yarn", "start"]