feat: setup docker, backend, and gitea pipeline for production
All checks were successful
Build and Deploy / build-and-push (push) Successful in 4m19s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 4m19s
This commit is contained in:
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@@ -0,0 +1,37 @@
|
||||
# Stage 1: Build Frontend
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json ./
|
||||
# In a real scenario, copy package-lock.json too
|
||||
# COPY package-lock.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production Runtime
|
||||
FROM node:22-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY package.json ./
|
||||
COPY backend/package.json ./backend/
|
||||
|
||||
# Install dependencies (including production deps for backend)
|
||||
RUN npm install --omit=dev
|
||||
|
||||
# Copy backend source
|
||||
COPY backend/ ./backend/
|
||||
|
||||
# Copy built frontend from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
EXPOSE 3001
|
||||
|
||||
CMD ["node", "backend/index.js"]
|
||||
Reference in New Issue
Block a user