tjo.space/Dockerfile

23 lines
600 B
Docker
Raw Normal View History

2023-09-11 12:33:16 +00:00
FROM node:lts as build
# Reduce npm log spam and colour during install within Docker
ENV NPM_CONFIG_LOGLEVEL=warn
ENV NPM_CONFIG_COLOR=false
2023-09-11 12:02:23 +00:00
2023-09-11 12:33:16 +00:00
WORKDIR /home/node/app
2023-09-11 12:02:23 +00:00
2023-09-11 12:33:16 +00:00
COPY --chown=node:node . /home/node/app/
2023-09-11 12:02:23 +00:00
2023-09-11 12:33:16 +00:00
RUN npm install
RUN npm run typecheck
RUN npm run build
2023-09-11 12:02:23 +00:00
FROM nginx:stable as production
2023-09-11 12:33:16 +00:00
WORKDIR /home/node/app
2024-01-01 22:53:34 +00:00
# Copy nginx config
COPY --chown=nobody:nogroup nginx.conf /etc/nginx/conf.d/default.conf
2023-09-11 12:02:23 +00:00
# Copy what we've installed/built from production
COPY --chown=nobody:nogroup --from=build /home/node/app/build /usr/share/nginx/html/
2024-02-06 12:33:34 +00:00
# Caching directory
RUN mkdir -p /var/run/nginx-cache