-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.production
More file actions
57 lines (41 loc) · 859 Bytes
/
Dockerfile.production
File metadata and controls
57 lines (41 loc) · 859 Bytes
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
FROM node:10.15.3
#
# Initial setup
#
RUN mkdir -p /usr/app
WORKDIR /usr/app
RUN mkdir api
RUN mkdir web
# Grant permissions to working directory
RUN chown -R node: /usr/app && chmod -R u+rw /usr/app
# Switch to non-root user
USER node
#
# Backend
#
# Install dependencies
WORKDIR /usr/app/api
COPY --chown=node:node ./api/package.json ./api/package-lock.json ./
RUN npm i && npm cache clean --force
# Copy remaining files
COPY --chown=node:node ./api .
# Build the project
RUN npm run build
#
# Frontend
#
WORKDIR /usr/app/web
COPY --chown=node:node ./web/package.json ./web/package-lock.json ./
RUN npm i && npm cache clean --force
# Copy remaining files
COPY --chown=node:node ./web .
# Build the frontend
RUN npm run build
# Back to api directory
WORKDIR /usr/app/api
#
# Final setup
#
# Not used by Heroku
# EXPOSE 3000
CMD ["node", "."]