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