-
Christophe Chaudier authoredChristophe Chaudier authored
Dockerfile 700 B
# --------[ BUILDER image ]--------
FROM node:14.15.4-alpine3.11 as builder
COPY package.json yarn.lock ./
RUN yarn install \
&& mkdir /app && mv ./node_modules ./app
WORKDIR /app
COPY . .
RUN yarn generate --fail-on-error
# --------[ PROD image ]--------
FROM nginx:1.19-alpine as prod
## Remove default nginx index page
RUN rm -rf /usr/share/nginx/html/*
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/app.conf /etc/nginx/conf.d/app.conf
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid && \
chown -R nginx:nginx /var/cache/nginx
COPY cmd.sh .
RUN chmod +x cmd.sh
USER nginx
EXPOSE 8080
COPY --from=builder /app/dist /var/www/
CMD [ "./cmd.sh" ]