Created
October 9, 2024 03:02
-
-
Save uratmangun/f151c63f99371978edc51b7e9312edb9 to your computer and use it in GitHub Desktop.
sharp nextjs docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM oven/bun:alpine AS base | |
| # Stage 1: Install dependencies | |
| FROM base AS deps | |
| WORKDIR /app | |
| COPY package.json bun.lockb ./ | |
| RUN bun install --frozen-lockfile | |
| # Stage 2: Build the application | |
| FROM base AS builder | |
| WORKDIR /app | |
| COPY --from=deps /app/node_modules ./node_modules | |
| RUN apk add --no-cache \ | |
| curl \ | |
| libstdc++ \ | |
| gcc \ | |
| g++ \ | |
| make \ | |
| python3 \ | |
| vips-dev \ | |
| build-base | |
| COPY . . | |
| RUN bun run build | |
| # Stage 3: Production server | |
| FROM base AS runner | |
| WORKDIR /app | |
| ENV NODE_ENV=production | |
| COPY --from=builder /app/public ./public | |
| COPY --from=builder /app/.next/standalone ./ | |
| COPY --from=builder /app/.next/static ./.next/static | |
| EXPOSE 3000 | |
| CMD ["bun", "run", "server.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment