zakscode/Dockerfile

32 lines
745 B
Docker
Raw Normal View History

2024-01-04 19:56:46 -05:00
FROM node:20-alpine as build
2022-05-02 21:10:15 -04:00
# Variables
ARG NODE_ENV=prod
2024-01-03 23:49:28 -05:00
ARG NODE_OPTIONS="--max_old_space_size=4096"
2022-05-02 21:10:15 -04:00
ENV NG_CLI_ANALYTICS=ci \
NODE_ENV=${NODE_ENV} \
NODE_OPTIONS=${NODE_OPTIONS}
# Setup
2024-01-04 19:56:46 -05:00
RUN mkdir /app
2022-05-02 21:10:15 -04:00
WORKDIR /app
COPY . .
2024-01-04 19:56:46 -05:00
# Build
RUN if [ ! -d "dist" ]; then npm install && npm run build; fi
2022-05-02 21:10:15 -04:00
# Use Nginx to serve
2024-01-04 19:56:46 -05:00
FROM nginx:1.23-alpine
COPY --from=build /app/dist /usr/share/nginx/html
# Copy aditional files
COPY package.json /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
2024-01-04 19:56:46 -05:00
# Setup environment varible script
COPY docker/setup-environment.sh /docker-entrypoint.d/setup-environment.sh
RUN chmod +x /docker-entrypoint.d/setup-environment.sh
2022-05-02 21:10:15 -04:00
EXPOSE 80