-
Notifications
You must be signed in to change notification settings - Fork 2
/
dockerfile
60 lines (41 loc) · 1.29 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM node:19-alpine as builder
# Turborepo deps
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
RUN npm i -g turbo
COPY . .
RUN turbo prune --scope=frontend --scope=backend --docker
FROM node:19-alpine as installer
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
COPY --from=builder /app/out/json/ .
RUN npm i
COPY --from=builder /app/out/full .
RUN cd ./apps/frontend && npm i
RUN cd ./apps/Backend && npm i
RUN cd ../../ # workdir
RUN npm i
RUN npm i -g turbo
COPY ./turbo.json .
RUN npm run build
FROM node:19-alpine as prod
WORKDIR /app
# Install Turborepo
RUN apk add --no-cache libc6-compat
RUN apk update
RUN npm i -g turbo
COPY ./turbo.json .
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 vue
#USER vue
COPY --chown=vue:nodejs ./package*.json .
COPY --from=installer --chown=vue:nodejs /app/apps/frontend/dist ./apps/frontend/dist
COPY --chown=vue:nodejs ./apps/frontend/package*.json ./apps/frontend
COPY --from=installer --chown=vue:nodejs /app/apps/Backend/dist ./apps/Backend/dist
COPY --chown=vue:nodejs ./apps/Backend/package*.json ./apps/Backend
RUN npm i --prefix ./apps/Backend # we have to install the backend deps here as it is not minified
EXPOSE 3000 9000
CMD [ "npm", "run", "serve" ]