2025-09-16 16:10:10+04:00
Some checks failed
Docker Build / docker (push) Failing after 40s
Docker Build / docker (pull_request) Failing after 38s

This commit is contained in:
2025-09-16 16:10:10 +04:00
parent b714abb0fe
commit 505daa0647

View File

@@ -1,28 +1,53 @@
# cat Dockerfile
# Stage 1: Builder
FROM node:20-alpine AS builder
# Stage 1: Dependencies
FROM node:20-alpine AS deps
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm@9.0.0
# Copy files
COPY pnpm-lock.yaml ./
COPY package.json ./
COPY turbo.json ./
# Copy dependency files first for better caching
COPY package.json pnpm-lock.yaml turbo.json ./
COPY apps/web/package.json ./apps/web/
# Add other app package.json files as needed
RUN pnpm install --frozen-lockfile
# Stage 2: Builder
FROM node:20-alpine AS builder
WORKDIR /app
RUN npm install -g pnpm@9.0.0
# Copy dependencies from previous stage
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json /app/pnpm-lock.yaml /app/turbo.json ./
# Copy source code
COPY . .
# Install deps and build
RUN pnpm install --frozen-lockfile
# Build the application
RUN pnpm build
# Stage 2: Runtime
FROM node:20-alpine
# Stage 3: Runtime
FROM node:20-alpine AS runtime
WORKDIR /app
COPY --from=builder /app ./
# Install pnpm for production
RUN npm install -g pnpm@9.0.0
# Copy package files
COPY package.json pnpm-lock.yaml turbo.json ./
COPY apps/web/package.json ./apps/web/
# Install only production dependencies
RUN pnpm install --prod --frozen-lockfile
# Copy built application from builder
COPY --from=builder /app/apps/web/dist ./apps/web/dist
COPY --from=builder /app/apps/web/server.js ./apps/web/
# Copy other necessary runtime files
# Create non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
USER nextjs
EXPOSE 3000
CMD ["node", "apps/web/server.js"]