generated from yandex-praktikum/client-server-template-with-vite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.ssr
47 lines (32 loc) · 1.15 KB
/
Dockerfile.ssr
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
38
39
40
41
42
43
44
45
46
47
ARG NODE_VERSION=16
ARG CLIENT_PORT=8080
FROM node:$NODE_VERSION-buster as base
WORKDIR /app
FROM base as builder
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn lerna bootstrap
RUN rm -rf /app/packages/server/dist/ && yarn build
FROM ubuntu:latest as os-ubuntu
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y netcat
RUN apt-get -y install nodejs
RUN npm install --global yarn
WORKDIR /app/client
COPY --from=builder /app/packages/client/dist/ /app/client/dist/
COPY --from=builder /app/packages/client/dist-ssr/ /app/client/dist-ssr/
COPY --from=builder /app/packages/client/package.json /app/client/package.json
RUN rm -rf /app/client/dist/assets/ && rm -rf /app/client/dist-ssr/assets/
RUN yarn install --production=true
RUN yarn link
WORKDIR /app
COPY --from=builder /app/packages/server/dist/ /app/
COPY --from=builder /app/packages/server/package.json /app/package.json
COPY --from=builder /app/utils/wait-for.sh /app/wait-for.sh
RUN chmod +x wait-for.sh
RUN yarn install --production=true
RUN yarn link client
EXPOSE $SERVER_PORT