mirror of
https://github.com/skidoodle/budgetable.git
synced 2025-02-15 03:39:14 +01:00
eppic fail
This commit is contained in:
parent
b710663e14
commit
cfccc4d177
1 changed files with 32 additions and 5 deletions
35
Dockerfile
35
Dockerfile
|
@ -1,8 +1,35 @@
|
||||||
|
# Base image
|
||||||
|
FROM node:20-alpine AS base
|
||||||
|
|
||||||
|
### Dependencies ###
|
||||||
|
FROM base AS deps
|
||||||
|
RUN apk add --no-cache libc6-compat git curl
|
||||||
|
|
||||||
|
# Setup pnpm environment
|
||||||
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
RUN corepack enable
|
||||||
|
RUN corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
RUN pnpm install --frozen-lockfile --prefer-frozen-lockfile
|
||||||
|
|
||||||
|
# Builder
|
||||||
|
FROM base AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
### Production image runner ###
|
### Production image runner ###
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
||||||
# Install curl for healthcheck
|
# Copy curl from deps stage
|
||||||
RUN apk add --no-cache curl
|
COPY --from=deps /usr/bin/curl /usr/bin/curl
|
||||||
|
|
||||||
# Disable Next.js telemetry
|
# Disable Next.js telemetry
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
@ -13,7 +40,7 @@ RUN adduser -SDH nextjs
|
||||||
RUN mkdir .next
|
RUN mkdir .next
|
||||||
RUN chown nextjs:nodejs .next
|
RUN chown nextjs:nodejs .next
|
||||||
|
|
||||||
# Automatically leverage output traces to reduce image size
|
# Copy built app from builder stage
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
@ -26,5 +53,5 @@ ENV PORT 3000
|
||||||
ENV HOSTNAME "0.0.0.0"
|
ENV HOSTNAME "0.0.0.0"
|
||||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD ["curl", "-f", "http://localhost:3000/health"]
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD ["curl", "-f", "http://localhost:3000/health"]
|
||||||
|
|
||||||
# Run the nextjs app
|
# Run the next.js app
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue