PriceGhost/backend/Dockerfile
clucraft 8992087220 Fix Dockerfiles: use npm install instead of npm ci
npm ci requires package-lock.json which wasn't generated.
Using npm install instead for builds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 14:02:06 -05:00

46 lines
711 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy source code
COPY . .
# Build TypeScript
RUN npm run build
# Production stage
FROM node:20-alpine AS production
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm install --omit=dev
# Copy built files from builder
COPY --from=builder /app/dist ./dist
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
USER nodejs
# Expose port
EXPOSE 3001
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3001
# Start the application
CMD ["node", "dist/index.js"]