-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
53 lines (39 loc) · 1.32 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
# FROM node:16.15.0-alpine as shared-build
# WORKDIR /usr/skillmex/shared
# COPY ./shared/package*.json .
# # Install shared dependencies and build
# RUN npm ci --only=production && npm cache clean --force
# COPY ./shared .
# RUN npm run build
FROM node:16.15.0-alpine as frontend-build
WORKDIR /usr/skillmex
COPY ./tsconfig.base.json .
COPY ./shared ./shared
# Copy frontend package.json and package-lock.json
WORKDIR /usr/skillmex/frontend
COPY ./frontend/package*.json .
# Install frontend dependencies and build
# RUN npm i -g @angular/cli @angular-devkit/build-angular
RUN npm install
COPY ./frontend .
RUN npm run build
FROM node:16.15.0-alpine as backend-build
# ENV NODE_ENV production
WORKDIR /usr/skillmex
COPY ./tsconfig.base.json .
COPY ./shared ./shared
# Install backend dependencies and build
WORKDIR /usr/skillmex/backend
COPY ./backend/package*.json .
RUN npm ci --only=production && npm cache clean --force
COPY ./backend .
RUN npm i tsconfig-paths
RUN npm run build
# Copy frontend dist into backend folder to be served
WORKDIR /usr/skillmex
RUN mkdir -p ./backend/frontend-dist
COPY --from=frontend-build /usr/skillmex/frontend/dist ./backend/frontend-dist
# Run the backend dist/main.js
WORKDIR /usr/skillmex/backend
# RUN npm i -g tsconfig-paths
CMD [ "node", "-r", "tsconfig-paths/register" , "dist/main.js" ]