Files
rsvp-manager/Dockerfile

46 lines
835 B
Docker

# Build stage
FROM node:18-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY frontend/package*.json ./frontend/
# Install dependencies
RUN npm install
RUN cd frontend && npm install
# Copy source files
COPY . .
COPY frontend ./frontend
# Build frontend
RUN cd frontend && npm run build
# Build backend
RUN npm run build
# Production stage
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm install --production
# Copy built files from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/frontend/build ./frontend/build
COPY --from=builder /app/database.sqlite ./database.sqlite
# Expose port
EXPOSE 3000
# Start the application
CMD ["npm", "start"]