31 lines
643 B
Docker
31 lines
643 B
Docker
# Backend Development Dockerfile for Placebo.mk NestJS API
|
|
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install build dependencies for native modules
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
# Install dependencies with better error handling
|
|
COPY package*.json ./
|
|
COPY package-lock.json* ./
|
|
|
|
# Clear npm cache and install dependencies
|
|
RUN npm cache clean --force && \
|
|
npm install
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Fix permissions - use node user that exists in base image
|
|
RUN chown -R node:node /app
|
|
|
|
# Switch to non-root user that exists in base image
|
|
USER node
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Start development server
|
|
CMD ["npm", "run", "start:dev"] |