-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (26 loc) · 895 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
# Use the desired Node.js version as the base image
ARG NODE_VERSION=20.2.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="Node.js"
# Set the working directory for the app
WORKDIR /app
# Set the production environment
ENV NODE_ENV=production
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends python2 pkg-config build-essential && \
rm -rf /var/lib/apt/lists/*
# Copy package.json and package-lock.json to install dependencies
COPY package.json package-lock.json ./
# Install app dependencies
RUN npm ci --only=production
# Copy the application code
COPY . .
# Final stage for the app image
FROM base
# Copy the built application from the previous stage
COPY --from=base /app /app
# Expose the desired port
EXPOSE 3000
# Start the server by default, this can be overwritten at runtime
CMD ["npm", "run", "start"]