Update Dockerfile and package.json for proper TypeScript build and deployment
This commit is contained in:
24
Dockerfile
24
Dockerfile
@@ -1,5 +1,7 @@
|
||||
FROM node:18-alpine
|
||||
# Build stage
|
||||
FROM node:18-alpine AS builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
@@ -12,10 +14,30 @@ 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
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user