zakscode/Dockerfile

26 lines
599 B
Docker
Raw Normal View History

2022-05-02 21:10:15 -04:00
FROM node:16 as build
# Variables
ARG NODE_ENV=prod
ARG NODE_OPTIONS=""
ENV NG_CLI_ANALYTICS=ci \
NODE_ENV=${NODE_ENV} \
NODE_OPTIONS=${NODE_OPTIONS}
# Setup
RUN npm config set unsafe-perm true && \
mkdir /app
WORKDIR /app
COPY . .
2022-05-02 21:49:10 -04:00
# Install & build
2022-05-02 21:54:25 -04:00
RUN if [ ! -d "dist" ] && [ ! -d "node_modules" ]; then npm install; fi
RUN if [ ! -d "dist" ]; then npm run build; fi
2022-05-02 21:10:15 -04:00
# Use Nginx to serve
FROM nginx:1.20-alpine
COPY --from=build /app/dist/zakscode /usr/share/nginx/html
2022-05-02 21:10:15 -04:00
COPY docker/robots.txt /usr/share/nginx/html/robots.txt
COPY docker/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80