Simplify Dockerfile to use npm install (works without lockfiles)
This commit is contained in:
25
Dockerfile
25
Dockerfile
@@ -6,12 +6,9 @@ WORKDIR /app/frontend
|
|||||||
# Copy frontend package files
|
# Copy frontend package files
|
||||||
COPY frontend/package*.json ./
|
COPY frontend/package*.json ./
|
||||||
|
|
||||||
# Generate lockfile if it doesn't exist, then install dependencies
|
# Install all dependencies (including devDependencies for build)
|
||||||
RUN if [ ! -f package-lock.json ]; then \
|
# Use npm install which works without lockfile
|
||||||
echo "Generating package-lock.json..."; \
|
RUN npm install
|
||||||
npm install --package-lock-only; \
|
|
||||||
fi && \
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
# Copy frontend source and build
|
# Copy frontend source and build
|
||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
@@ -25,12 +22,8 @@ WORKDIR /app/backend
|
|||||||
# Copy backend package files
|
# Copy backend package files
|
||||||
COPY backend/package*.json ./
|
COPY backend/package*.json ./
|
||||||
|
|
||||||
# Generate lockfile if it doesn't exist, then install dependencies
|
# Install all dependencies (including TypeScript)
|
||||||
RUN if [ ! -f package-lock.json ]; then \
|
RUN npm install
|
||||||
echo "Generating package-lock.json..."; \
|
|
||||||
npm install --package-lock-only; \
|
|
||||||
fi && \
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
# Copy backend source and compile TypeScript
|
# Copy backend source and compile TypeScript
|
||||||
COPY backend/ ./
|
COPY backend/ ./
|
||||||
@@ -44,12 +37,8 @@ WORKDIR /app
|
|||||||
# Copy backend package files
|
# Copy backend package files
|
||||||
COPY backend/package*.json ./
|
COPY backend/package*.json ./
|
||||||
|
|
||||||
# Generate lockfile if it doesn't exist, then install production dependencies only
|
# Install production dependencies only
|
||||||
RUN if [ ! -f package-lock.json ]; then \
|
RUN npm install --omit=dev && \
|
||||||
echo "Generating package-lock.json..."; \
|
|
||||||
npm install --package-lock-only; \
|
|
||||||
fi && \
|
|
||||||
npm ci --omit=dev && \
|
|
||||||
npm cache clean --force
|
npm cache clean --force
|
||||||
|
|
||||||
# Copy compiled backend from builder
|
# Copy compiled backend from builder
|
||||||
|
|||||||
Reference in New Issue
Block a user