31 lines
505 B
Docker
31 lines
505 B
Docker
# Stage 1: Build Frontend
|
|
FROM node:18-alpine AS frontend-builder
|
|
|
|
WORKDIR /app/frontend
|
|
COPY frontend/package*.json ./
|
|
RUN npm install
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Setup Backend
|
|
FROM node:18-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy backend files
|
|
COPY backend/package*.json ./
|
|
RUN npm install --production
|
|
|
|
COPY backend/ ./
|
|
|
|
# Copy built frontend
|
|
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
ENV PORT=80
|
|
|
|
# Start the server
|
|
CMD ["node", "src/index.js"]
|