Compare commits

..

8 Commits

Author SHA1 Message Date
bd69dbceaf Merge pull request 'update Dockerfile' (#5) from dockerfile-update into dev
Some checks failed
Docker Build / docker (push) Failing after 2m0s
Reviewed-on: #5
2025-09-16 15:17:46 +02:00
5a890ac253 2025-09-16 17:12:14+04:00
Some checks failed
Docker Build / docker (push) Failing after 1m16s
Docker Build / docker (pull_request) Failing after 1m22s
2025-09-16 17:12:14 +04:00
b94e205787 Merge pull request 'feature/add-docker-build' (#4) from feature/add-docker-build into dev
Some checks failed
Docker Build / docker (push) Failing after 40s
Reviewed-on: #4
2025-09-16 14:14:37 +02:00
7ff599aae0 2025-09-16 16:10:10+04:00 2025-09-16 14:14:37 +02:00
9d8ef03fea 2025-09-16 15:51:23+04:00 2025-09-16 14:14:37 +02:00
a4a95e8649 2025-09-16 13:59:28+04:00 2025-09-16 14:14:37 +02:00
c7f6ad43c4 2025-09-16 10:35:19+04:00 2025-09-16 14:14:37 +02:00
a4ad1d8645 add dockerfile 2025-09-16 14:14:37 +02:00
2 changed files with 40 additions and 17 deletions

6
.dockerignore Normal file
View File

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

View File

@@ -3,10 +3,19 @@ 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 dependency files first for better caching # Copy all package.json files for proper dependency resolution
COPY package.json pnpm-lock.yaml turbo.json ./ COPY package.json pnpm-lock.yaml turbo.json pnpm-workspace.yaml ./
COPY apps/web/package.json ./apps/web/ COPY apps/web/package.json ./apps/web/
# Add other app package.json files as needed COPY apps/pocketbase/package.json ./apps/pocketbase/
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
@@ -15,39 +24,47 @@ 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 from previous stage # Copy dependencies and source
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json /app/pnpm-lock.yaml /app/turbo.json ./ COPY --from=deps /app/pnpm-lock.yaml ./
# Copy source code
COPY . . COPY . .
# Build the application # Build only the web app
RUN pnpm build RUN pnpm turbo build --filter=web
# 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 # Copy package files for production install
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 application from builder # Copy built Next.js application
COPY --from=builder /app/apps/web/dist ./apps/web/dist COPY --from=builder /app/apps/web/.next ./apps/web/.next
COPY --from=builder /app/apps/web/server.js ./apps/web/ COPY --from=builder /app/apps/web/public ./apps/web/public
# Copy other necessary runtime files COPY --from=builder /app/apps/web/next.config.js ./apps/web/
COPY --from=builder /app/apps/web/package.json ./apps/web/
# Create non-root user for security # Copy other necessary files
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"]