2021-04-21 14:16:56 +00:00
|
|
|
## BUILD STAGE
|
|
|
|
FROM node:14 as build-stage
|
2021-04-13 14:04:14 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2021-04-21 14:16:56 +00:00
|
|
|
# Prepare node dependencies
|
|
|
|
RUN apt-get update && apt-get install libsecret-1-0 -y
|
2021-04-21 14:14:06 +00:00
|
|
|
COPY package*.json ./
|
2023-02-21 13:02:48 +00:00
|
|
|
COPY patches ./patches
|
|
|
|
RUN echo "unsafe-perm=true" > ./.npmrc
|
2022-01-14 11:11:20 +00:00
|
|
|
RUN npm ci --no-audit
|
2021-04-21 14:14:06 +00:00
|
|
|
|
2021-04-21 14:16:56 +00:00
|
|
|
# Build source
|
|
|
|
ARG build_command="npm run build:prod"
|
2021-04-21 14:14:06 +00:00
|
|
|
COPY . /app
|
2021-04-21 14:16:56 +00:00
|
|
|
RUN ${build_command}
|
2021-04-13 14:04:14 +00:00
|
|
|
|
2021-04-21 14:16:56 +00:00
|
|
|
## SERVE STAGE
|
|
|
|
FROM nginx:alpine as serve-stage
|
2021-04-13 14:04:14 +00:00
|
|
|
|
2021-05-04 07:30:08 +00:00
|
|
|
# Copy assets & config
|
2021-04-21 14:16:56 +00:00
|
|
|
COPY --from=build-stage /app/www /usr/share/nginx/html
|
2021-05-04 07:30:08 +00:00
|
|
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
2021-07-06 09:18:07 +00:00
|
|
|
HEALTHCHECK --interval=10s --timeout=4s CMD curl -f http://localhost/assets/env.json || exit 1
|