-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile.compose
More file actions
74 lines (53 loc) · 1.86 KB
/
Dockerfile.compose
File metadata and controls
74 lines (53 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM node:20-alpine AS base
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
RUN npm install --legacy-peer-deps
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
# Copy the entire project
COPY . .
# Generate Prisma client
RUN npx prisma generate
# Next.js collects completely anonymous telemetry data about general usage.
ENV NEXT_TELEMETRY_DISABLED 1
ENV DOCKER_BUILD 1
ENV CI_BUILD_MODE 1
# Build the app
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
# Install all dependencies to satisfy entrypoint requirements
COPY package.json package-lock.json* ./
RUN npm install --legacy-peer-deps
# Install Prisma client with exact version match
RUN npm uninstall prisma @prisma/client --legacy-peer-deps
RUN npm install prisma@6.3.1 @prisma/client@6.3.1 --legacy-peer-deps
# Install tsx explicitly
RUN npm install -g tsx
# Install esbuild for widget
RUN npm install esbuild --legacy-peer-deps
# Install JSDOC
RUN npm install -g jsdoc
# Add bash and curl for the entry script and health checks
RUN apk add --no-cache bash curl
# Copy the entire project from the builder stage
COPY --from=builder /app .
# Copy maintenance page and server script
COPY scripts/maintenance/index.html ./index.html
COPY scripts/maintenance/server.js ./scripts/maintenance/server.js
# Copy entrypoint script and fix line endings
COPY docker-entrypoint-compose.sh /app/docker-entrypoint-compose.sh
RUN sed -i 's/\r$//' /app/docker-entrypoint-compose.sh && chmod +x /app/docker-entrypoint-compose.sh
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
# Use npm script that explicitly calls bash
ENTRYPOINT ["bash", "docker-entrypoint-compose.sh"]