-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfileLiveDev
35 lines (25 loc) · 992 Bytes
/
DockerfileLiveDev
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
FROM node:hydrogen-slim as node
ENV NODE_ENV=production
EXPOSE 5000
RUN mkdir /storage-node && chown -R node:node /storage-node
WORKDIR /storage-node
# this ensures we fix simlinks for npx and yarn
RUN corepack disable && corepack enable
RUN apt-get update \
&& apt-get -qq install -y --no-install-recommends \
git ca-certificates dnsutils \
&& rm -rf /var/lib/apt/lists/*
# new stage
FROM node AS source
USER node
# Expect this to be run with the source dir mounted at /storage-node
# Copy the current directory
# COPY --chown=node:node . .
# we need devDependencies to build. Setting --production=false ignores NODE_ENV (deliberatly)
# RUN yarn install --production=false --frozen-lockfile
# we have to build inside the container in case we are on a Mac building a linux image
# RUN yarn build
### prod stage
# Note: use --init option when running the container to have better signal forwarding
FROM source as prod
CMD ["node", "--trace-warnings", "./dist/server.js"]