mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-22 08:06:42 +00:00
Initial commit: Sencho V1 complete with Auth and Dockerization
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
# Stage 1: Build Frontend
|
||||
FROM node:20-alpine AS frontend-builder
|
||||
|
||||
WORKDIR /app/frontend
|
||||
|
||||
# Copy frontend package files
|
||||
COPY frontend/package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy frontend source
|
||||
COPY frontend/ ./
|
||||
|
||||
# Build frontend
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Build Backend
|
||||
FROM node:20-alpine AS backend-builder
|
||||
|
||||
WORKDIR /app/backend
|
||||
|
||||
# Copy backend package files
|
||||
COPY backend/package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy backend source
|
||||
COPY backend/ ./
|
||||
|
||||
# Build backend
|
||||
RUN npm run build
|
||||
|
||||
# Stage 3: Production
|
||||
FROM node:20-alpine
|
||||
|
||||
# Install Docker CLI and Docker Compose CLI
|
||||
RUN apk add --no-cache docker-cli docker-cli-compose
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built backend and node_modules from backend-builder
|
||||
COPY --from=backend-builder /app/backend/dist ./dist
|
||||
COPY --from=backend-builder /app/backend/node_modules ./node_modules
|
||||
COPY --from=backend-builder /app/backend/package.json ./
|
||||
|
||||
# Copy built frontend from frontend-builder to public folder
|
||||
COPY --from=frontend-builder /app/frontend/dist ./public
|
||||
|
||||
# Set environment to production
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the server
|
||||
CMD ["node", "dist/index.js"]
|
||||
Reference in New Issue
Block a user