Compare commits

..

6 Commits

Author SHA1 Message Date
6e9b46eeb0 Merge branch 'dev' into feature/add-docker-build
Some checks failed
Docker Build / docker (push) Failing after 37s
Docker Build / docker (pull_request) Failing after 38s
2025-09-16 14:12:34 +02:00
505daa0647 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
2025-09-16 16:10:10 +04:00
b714abb0fe 2025-09-16 15:51:23+04:00
Some checks failed
Docker Build / docker (push) Failing after 2m25s
Docker Build / docker (pull_request) Failing after 2m17s
2025-09-16 15:51:23 +04:00
7e47ec01df 2025-09-16 13:59:28+04:00
Some checks failed
Docker Build / docker (push) Failing after 1m39s
2025-09-16 13:59:28 +04:00
d2551f106d 2025-09-16 10:35:19+04:00
Some checks failed
Docker Build / docker (push) Failing after 1m37s
2025-09-16 10:35:19 +04:00
68b5d46249 add dockerfile
Some checks failed
Docker Build / docker (push) Failing after 2m6s
2025-09-16 09:38:53 +04:00
2 changed files with 17 additions and 40 deletions

View File

@@ -1,6 +0,0 @@
node_modules
.git
.next
dist
*.log
.env.local

View File

@@ -3,19 +3,10 @@ FROM node:20-alpine AS deps
WORKDIR /app WORKDIR /app
RUN npm install -g pnpm@9.0.0 RUN npm install -g pnpm@9.0.0
# Copy all package.json files for proper dependency resolution # Copy dependency files first for better caching
COPY package.json pnpm-lock.yaml turbo.json pnpm-workspace.yaml ./ COPY package.json pnpm-lock.yaml turbo.json ./
COPY apps/web/package.json ./apps/web/ COPY apps/web/package.json ./apps/web/
COPY apps/pocketbase/package.json ./apps/pocketbase/ # Add other app package.json files as needed
COPY packages/*/package.json ./packages/
# Create the directory structure that might be missing
RUN mkdir -p packages/ui packages/eslint-config packages/typescript-config
# Copy package.json files to their correct locations
COPY packages/ui/package.json ./packages/ui/
COPY packages/eslint-config/package.json ./packages/eslint-config/
COPY packages/typescript-config/package.json ./packages/typescript-config/
RUN pnpm install --frozen-lockfile RUN pnpm install --frozen-lockfile
@@ -24,47 +15,39 @@ FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
RUN npm install -g pnpm@9.0.0 RUN npm install -g pnpm@9.0.0
# Copy dependencies and source # Copy dependencies from previous stage
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/pnpm-lock.yaml ./ COPY --from=deps /app/package.json /app/pnpm-lock.yaml /app/turbo.json ./
# Copy source code
COPY . . COPY . .
# Build only the web app # Build the application
RUN pnpm turbo build --filter=web RUN pnpm build
# Stage 3: Runtime # Stage 3: Runtime
FROM node:20-alpine AS runtime FROM node:20-alpine AS runtime
WORKDIR /app WORKDIR /app
# Install pnpm for production
RUN npm install -g pnpm@9.0.0 RUN npm install -g pnpm@9.0.0
# Copy package files for production install # Copy package files
COPY package.json pnpm-lock.yaml turbo.json ./ COPY package.json pnpm-lock.yaml turbo.json ./
COPY apps/web/package.json ./apps/web/ COPY apps/web/package.json ./apps/web/
COPY packages/*/package.json ./packages/
# Install only production dependencies # Install only production dependencies
RUN pnpm install --prod --frozen-lockfile RUN pnpm install --prod --frozen-lockfile
# Copy built Next.js application # Copy built application from builder
COPY --from=builder /app/apps/web/.next ./apps/web/.next COPY --from=builder /app/apps/web/dist ./apps/web/dist
COPY --from=builder /app/apps/web/public ./apps/web/public COPY --from=builder /app/apps/web/server.js ./apps/web/
COPY --from=builder /app/apps/web/next.config.js ./apps/web/ # Copy other necessary runtime files
COPY --from=builder /app/apps/web/package.json ./apps/web/
# Copy other necessary files # Create non-root user for security
COPY --from=builder /app/apps/web/lib ./apps/web/lib
COPY --from=builder /app/apps/web/messages ./apps/web/messages
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \ RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001 adduser -S nextjs -u 1001
# Change ownership of the app directory
RUN chown -R nextjs:nodejs /app
USER nextjs USER nextjs
EXPOSE 3000 EXPOSE 3000
CMD ["node", "apps/web/server.js"]
# Use Next.js start command
CMD ["pnpm", "--filter=web", "start"]