2020-06-18 11:46:24 +02:00
|
|
|
FROM node:14-alpine AS deps
|
|
|
|
|
|
|
|
ARG REACT_APP_INCLUDE_GTAG=false
|
2020-04-29 07:53:07 +02:00
|
|
|
|
2020-06-18 11:46:24 +02:00
|
|
|
RUN mkdir /opt/node_app && chown node:node /opt/node_app
|
|
|
|
WORKDIR /opt/node_app
|
|
|
|
|
|
|
|
USER node
|
2020-04-29 07:53:07 +02:00
|
|
|
|
|
|
|
COPY package.json package-lock.json ./
|
2020-06-18 11:46:24 +02:00
|
|
|
RUN npm install --no-optional && npm cache clean --force
|
|
|
|
ENV PATH /opt/node_app/node_modules/.bin:$PATH
|
2020-04-29 07:53:07 +02:00
|
|
|
|
2020-06-18 11:46:24 +02:00
|
|
|
WORKDIR /opt/node_app
|
2020-04-29 07:53:07 +02:00
|
|
|
COPY . .
|
2020-06-18 11:46:24 +02:00
|
|
|
|
|
|
|
FROM node:14-alpine AS build
|
|
|
|
|
|
|
|
ARG NODE_ENV=production
|
|
|
|
|
|
|
|
WORKDIR /opt/node_app
|
|
|
|
COPY --from=deps /opt/node_app .
|
2020-06-18 13:18:57 +02:00
|
|
|
RUN npm run build:app:docker
|
2020-04-29 07:53:07 +02:00
|
|
|
|
|
|
|
FROM nginx:1.17-alpine
|
|
|
|
|
2020-06-18 11:46:24 +02:00
|
|
|
COPY --from=build /opt/node_app/build /usr/share/nginx/html
|
2020-04-29 07:53:07 +02:00
|
|
|
|
|
|
|
HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1
|