Skip to content

Commit cfccc4d

Browse files
committed
eppic fail
1 parent b710663 commit cfccc4d

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

Dockerfile

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1+
# Base image
2+
FROM node:20-alpine AS base
3+
4+
### Dependencies ###
5+
FROM base AS deps
6+
RUN apk add --no-cache libc6-compat git curl
7+
8+
# Setup pnpm environment
9+
ENV PNPM_HOME="/pnpm"
10+
ENV PATH="$PNPM_HOME:$PATH"
11+
RUN corepack enable
12+
RUN corepack prepare pnpm@latest --activate
13+
14+
WORKDIR /app
15+
16+
COPY package.json pnpm-lock.yaml ./
17+
RUN pnpm install --frozen-lockfile --prefer-frozen-lockfile
18+
19+
# Builder
20+
FROM base AS builder
21+
22+
WORKDIR /app
23+
24+
COPY . ./
25+
COPY --from=deps /app/node_modules ./node_modules
26+
RUN pnpm build
27+
128
### Production image runner ###
229
FROM base AS runner
330

4-
# Install curl for healthcheck
5-
RUN apk add --no-cache curl
31+
# Copy curl from deps stage
32+
COPY --from=deps /usr/bin/curl /usr/bin/curl
633

734
# Disable Next.js telemetry
835
ENV NEXT_TELEMETRY_DISABLED 1
@@ -13,7 +40,7 @@ RUN adduser -SDH nextjs
1340
RUN mkdir .next
1441
RUN chown nextjs:nodejs .next
1542

16-
# Automatically leverage output traces to reduce image size
43+
# Copy built app from builder stage
1744
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
1845
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
1946
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
@@ -24,7 +51,7 @@ USER nextjs
2451
EXPOSE 3000
2552
ENV PORT 3000
2653
ENV HOSTNAME "0.0.0.0"
27-
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "curl", "-f", "http://localhost:3000/health" ]
54+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD ["curl", "-f", "http://localhost:3000/health"]
2855

29-
# Run the nextjs app
56+
# Run the next.js app
3057
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)