-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
37 lines (25 loc) · 848 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
# Stage 1, Build the code
FROM node:16-alpine as builder
WORKDIR /app
COPY package.json yarn.lock ./
COPY webapp/package.json webapp/yarn.lock ./webapp/
# Install ALL the dependencies of the server and webapp
RUN yarn install --frozen-lockfile
RUN yarn --cwd webapp/ install --frozen-lockfile
COPY . ./
# Build the server
RUN yarn build
# Build the webapp
RUN yarn --cwd webapp/ build
# Stage 2, create the production image
FROM node:16-alpine
WORKDIR /app
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/webapp/package.json ./webapp/package.json
COPY ./.env ./.env
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/webapp/build ./webapp/build
RUN yarn install --production --frozen-lockfile
RUN yarn --cwd ./webapp/ install --production --frozen-lockfile
EXPOSE 4000
CMD node dist/server.js