forked from broadinstitute/exome-results-browsers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (33 loc) · 1.21 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
FROM node:12.18.1-alpine
RUN mkdir -p /home/node/app && chown -R node:node /home/node/app
WORKDIR /home/node/app
USER node
ENV NODE_ENV=production
# Install dependencies
COPY --chown=node:node package.json .
COPY --chown=node:node src/browsers/package.json src/browsers/package.json
COPY --chown=node:node yarn.lock .
RUN yarn install --production false --frozen-lockfile && yarn cache clean
# Copy frontend source
COPY --chown=node:node babel.config.js .
COPY --chown=node:node src/browsers ./src/browsers
# Build frontend
COPY --chown=node:node build.env .
RUN export $(cat build.env | xargs); yarn run build
###############################################################################
FROM node:12.18.1-alpine
RUN mkdir -p /home/node/app && chown -R node:node /home/node/app
WORKDIR /home/node/app
USER node
ENV NODE_ENV=production
ENV PORT=8000
# Install dependencies
COPY --chown=node:node src/server/package.json .
COPY --chown=node:node yarn.lock .
RUN yarn install --production --frozen-lockfile && yarn cache clean
# Copy frontend from build stage
COPY --chown=node:node --from=0 /home/node/app/src/server/public ./public
# Copy server source
COPY --chown=node:node src/server .
# Run
CMD ["node", "server.js"]