-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
75 lines (55 loc) · 1.88 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# ====================================================
# BUILD IMAGE
# ====================================================
FROM node:16-alpine AS BUILD_IMAGE
ENV NODE_ENV=development
# Disable npm update message
RUN npm config set update-notifier false
# ====================================
# Install dependencies
# ====================================
WORKDIR /build
COPY package*.json .
COPY backend/package*.json backend/
COPY frontend/package*.json frontend/
RUN npm -d ci
# ====================================
# Copy and build
# ====================================
ENV NODE_ENV=production
ENV HEADLESS=true
# Backend must go first
COPY backend backend
RUN npm run --workspace=backend build
COPY frontend frontend
RUN npm run --workspace=frontend build
RUN mkdir -p backend/static/app/js/ && mv frontend/build/* backend/static/app/js/
# Cleanup
RUN rm -rf /build/backend/src
# ====================================
# Prune non-production dependencies
# ====================================
RUN npm prune --workspaces --production
# ====================================================
# APP IMAGE
# ====================================================
FROM node:16-alpine AS APP_IMAGE
ENV NODE_ENV=production
# Install headless JRE, disable npm update notice.
RUN apk update \
&& apk add openjdk11-jre-headless \
&& npm config set update-notifier false
# ====================================
# Copy built files
# ====================================
WORKDIR /app
# Move built JS to static app
COPY --from=BUILD_IMAGE /build/backend /app
# Copy dependencies
COPY --from=BUILD_IMAGE /build/node_modules /app/node_modules
# ====================================
# Start
# ====================================
ENV PORT 80
EXPOSE 80
CMD [ "node", "build/PagasaParserWeb.js" ]