-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.app
65 lines (43 loc) · 1.99 KB
/
Dockerfile.app
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
59
60
61
62
63
64
65
FROM node:alpine as deps-container
WORKDIR /tmp/deps
COPY --chown=node:node package.json .
COPY --chown=node:node package-lock.json .
COPY --chown=node:node packages/rimun-api/package.json ./packages/rimun-api/
COPY --chown=node:node packages/rimun-app/package.json ./packages/rimun-app/
RUN npm ci --include=dev
COPY --chown=node:node prisma ./
RUN npm run db:generate
###
FROM node:alpine as build-container
WORKDIR /tmp/build
# copy packages
COPY --chown=node:node package.json .
COPY --chown=node:node packages/rimun-api/package.json ./packages/rimun-api/
COPY --chown=node:node packages/rimun-api/package.json ./packages/rimun-api/
COPY --chown=node:node packages/rimun-app/package.json ./packages/rimun-app/
# copy tsconfigs
COPY --chown=node:node tsconfig.base.json .
COPY --chown=node:node packages/rimun-api/tsconfig.json ./packages/rimun-api/
COPY --chown=node:node packages/rimun-app/tsconfig.json ./packages/rimun-app/
COPY --chown=node:node packages/rimun-app/tsconfig.node.json ./packages/rimun-app/
# copy source code
COPY --chown=node:node packages/rimun-app/index.html ./packages/rimun-app/
COPY --chown=node:node packages/rimun-app/tailwind.config.js ./packages/rimun-app/
COPY --chown=node:node packages/rimun-app/postcss.config.cjs ./packages/rimun-app/
COPY --chown=node:node packages/rimun-app/vite.config.ts ./packages/rimun-app/
COPY --chown=node:node packages/rimun-app/src ./packages/rimun-app/src
COPY --chown=node:node packages/rimun-app/public ./packages/rimun-app/public
COPY --chown=node:node packages/rimun-api/src ./packages/rimun-api/src
# copy deps
COPY --chown=node:node --from=deps-container /tmp/deps/node_modules ./node_modules
RUN chown -R node:node /tmp/build
USER node
RUN npm -w @rimun/api run build
RUN npm -w @rimun/app run build
###
FROM nginx:alpine as runtime-container
COPY packages/rimun-app/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build-container /tmp/build/packages/rimun-app/dist /usr/share/nginx/html
ENV PORT 8080
ENV HOST 0.0.0.0
EXPOSE 8080