fix: Improve Docker layer caching on frontend changes

Avoid any changes in the `frontend/` folder to trigger `npm install`.
Instead, split the copies to have separate steps for install and build.
This commit is contained in:
Michael Manganiello
2024-06-22 18:40:30 -03:00
parent 5f2e0ea71f
commit 32ef612b0a

View File

@@ -1,8 +1,12 @@
# Build frontend
FROM node:lts-alpine as front-build-stage
WORKDIR /front
COPY ./frontend/package*.json ./
RUN npm ci
COPY ./frontend ./
RUN npm install && npm run build
RUN npm run build
# Setup frontend and backend
FROM nginx:1.27.0-alpine3.19-slim as production-stage