diff --git a/deploy/Dockerfile.backend b/deploy/Dockerfile.backend index 837ae91..25a180c 100644 --- a/deploy/Dockerfile.backend +++ b/deploy/Dockerfile.backend @@ -1,9 +1,9 @@ FROM node:20-alpine AS builder WORKDIR /app -COPY backend/package*.json ./ -# Use npm ci if a lockfile exists, otherwise fall back to npm install -RUN sh -c 'if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then npm ci --production; else npm install --production; fi' -COPY backend/ ./ +COPY backend/package*.json backend/ +# Use npm ci if a lockfile exists in backend, otherwise fall back to npm install +RUN sh -c 'if [ -f backend/package-lock.json ] || [ -f backend/npm-shrinkwrap.json ]; then npm ci --prefix backend --production; else npm install --prefix backend --production; fi' +COPY backend/ backend/ RUN npm run build --prefix backend FROM node:20-alpine diff --git a/deploy/Dockerfile.frontend b/deploy/Dockerfile.frontend index 6cd090c..9aa28c8 100644 --- a/deploy/Dockerfile.frontend +++ b/deploy/Dockerfile.frontend @@ -1,9 +1,9 @@ FROM node:20-alpine AS builder WORKDIR /app -COPY frontend/package*.json ./ -# Use npm ci when lockfile exists, fallback to npm install -RUN sh -c 'if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then npm ci; else npm install; fi' -COPY frontend/ ./ +COPY frontend/package*.json frontend/ +# Use npm ci when lockfile exists in frontend, fallback to npm install +RUN sh -c 'if [ -f frontend/package-lock.json ] || [ -f frontend/npm-shrinkwrap.json ]; then npm ci --prefix frontend; else npm install --prefix frontend; fi' +COPY frontend/ frontend/ RUN npm run build --prefix frontend FROM nginx:stable-alpine