-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
36 lines (27 loc) · 726 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
# Use Node.js 20 alpine image as builder
FROM node:20.17.0-alpine as builder
# Set up working directory
RUN mkdir /app
WORKDIR /app
# Upgrade and install git
RUN apk --no-cache add git
# Copy essential files
COPY package.json pnpm-lock.yaml tsconfig.json ./
COPY src src
# Install dependencies and build
RUN npm install -g pnpm
RUN pnpm install
ENV NODE_ENV=production
RUN pnpm run build
# Set up the production image
FROM node:20.17.0-alpine
WORKDIR /app
# Copy build output from builder
COPY --from=builder /app .
# Expose port for health check with fly.io
EXPOSE 3000/tcp
# Set SERVER_HOSTNAME environment variable
ENV SERVER_HOSTNAME=0.0.0.0
ENV PORT=3000
# Start the application
CMD ["npm", "run", "start:prod"]