add workflow
Some checks failed
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Failing after 9s
Build and Deploy Frontend Learner / Deploy Frontend Learner to Server (push) Has been skipped
Build and Deploy Frontend Management / Build Frontend Management Docker Image (push) Failing after 9s
Build and Deploy Backend / Build Backend Docker Image (push) Failing after 9s
Build and Deploy Frontend Management / Deploy Frontend Management to Server (push) Has been skipped
Build and Deploy Backend / Deploy Backend to Server (push) Has been skipped
Some checks failed
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Failing after 9s
Build and Deploy Frontend Learner / Deploy Frontend Learner to Server (push) Has been skipped
Build and Deploy Frontend Management / Build Frontend Management Docker Image (push) Failing after 9s
Build and Deploy Backend / Build Backend Docker Image (push) Failing after 9s
Build and Deploy Frontend Management / Deploy Frontend Management to Server (push) Has been skipped
Build and Deploy Backend / Deploy Backend to Server (push) Has been skipped
This commit is contained in:
parent
15794fab16
commit
4ec1d34297
6 changed files with 364 additions and 0 deletions
55
Backend/Dockerfile
Normal file
55
Backend/Dockerfile
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# Build stage
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY pnpm-lock.yaml* ./
|
||||
|
||||
# Install pnpm and dependencies
|
||||
RUN npm install -g pnpm && pnpm install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Generate Prisma client
|
||||
RUN pnpm prisma:generate
|
||||
|
||||
# Build application
|
||||
RUN pnpm build
|
||||
|
||||
# Production stage
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY pnpm-lock.yaml* ./
|
||||
|
||||
# Install production dependencies only
|
||||
RUN pnpm install --prod --frozen-lockfile
|
||||
|
||||
# Copy built files from builder
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Set environment
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=4000
|
||||
|
||||
# Expose port
|
||||
EXPOSE 4000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:4000/health || exit 1
|
||||
|
||||
# Start application
|
||||
CMD ["node", "dist/server.js"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue