This commit is contained in:
parent
56d013c61f
commit
f0dede9368
15
Dockerfile
15
Dockerfile
@ -1,9 +1,8 @@
|
|||||||
FROM fascinated/docker-images:nodejs_20_with_pnpm AS base
|
FROM fascinated/docker-images:nodejs_20_with_pnpm AS base
|
||||||
|
|
||||||
# Install dependencies, including Python and build tools for building the app
|
# Install dependencies and build tools for canvas
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
# Install necessary packages for canvas build
|
RUN apk add --no-cache libc6-compat
|
||||||
RUN apk add --no-cache libc6-compat python3 make g++ gcc pkgconfig pixman cairo-dev libjpeg-turbo-dev pango-dev giflib-dev
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json* pnpm-lock.yaml* ./
|
COPY package.json* pnpm-lock.yaml* ./
|
||||||
RUN pnpm install --frozen-lockfile --quiet
|
RUN pnpm install --frozen-lockfile --quiet
|
||||||
@ -13,6 +12,9 @@ FROM base AS builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN apk add --no-cache python3 make g++ gcc pkgconfig pixman cairo-dev libjpeg-turbo-dev pango-dev giflib-dev
|
||||||
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
# Add the commit hash
|
# Add the commit hash
|
||||||
@ -22,12 +24,12 @@ ENV GIT_REV=${GIT_REV}
|
|||||||
# Build the app
|
# Build the app
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
# Run the app
|
# Final stage to run the app
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install runtime dependencies (not dev packages) needed for canvas
|
# Install only runtime dependencies (not -dev packages) for canvas and cairo
|
||||||
RUN apk add --no-cache libc6-compat cairo pango libjpeg-turbo giflib
|
RUN apk add --no-cache cairo pango
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
@ -42,6 +44,7 @@ RUN chown nextjs:nodejs .next
|
|||||||
ARG GIT_REV
|
ARG GIT_REV
|
||||||
ENV GIT_REV=${GIT_REV}
|
ENV GIT_REV=${GIT_REV}
|
||||||
|
|
||||||
|
# Copy the built app from the builder stage
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
Reference in New Issue
Block a user