-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Dockerfile
36 lines (31 loc) · 1.12 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
# ---- Base Node with Alpine ----
FROM node:18.20.3-alpine3.18 AS base
# Set working directory in the container
WORKDIR /app
# Copy package.json and yarn.lock files to the workspace
COPY package.json yarn.lock ./
# ---- Dependencies ----
FROM base AS dependencies
# Install production dependencies
RUN yarn install --production --frozen-lockfile
# Copy only the production node_modules for later use
RUN cp -R node_modules prod_node_modules
# Install all dependencies, including 'devDependencies'
RUN yarn install --frozen-lockfile
# ---- Release ----
FROM node:18.20.3-alpine3.18 AS release
# Set working directory
WORKDIR /app
# Copy production node_modules
COPY --from=dependencies /app/prod_node_modules ./node_modules
# Copy your source code
COPY . .
# Link the config file (from any possible location)
RUN ln -s /config/config.json /app/config.development.json && \
ln -s /config/config.json /app/config.test.json && \
ln -s /config/config.json /app/config.staging.json && \
ln -s /config/config.json /app/config.production.json
# Expose the port the app runs on
EXPOSE 2369
# Run your application
CMD ["yarn", "start"]