-
Notifications
You must be signed in to change notification settings - Fork 32
Added Dockerfile
#156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Added Dockerfile
#156
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # dependencies | ||
| node_modules | ||
| .pnp | ||
| .pnp.* | ||
|
|
||
| # build output | ||
| .next | ||
| out | ||
| build | ||
| dist | ||
|
|
||
| # env files (provide at runtime, not build time) | ||
| .env | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| # version control | ||
| .git | ||
| .gitignore | ||
|
|
||
| # editor / tooling | ||
| .claude | ||
| .conductor | ||
| .ruby-lsp | ||
| .vscode | ||
| .idea | ||
| .DS_Store | ||
|
|
||
| # CI / docs / tests (not needed in image) | ||
| .github | ||
| docs | ||
| README.md | ||
| LICENSE | ||
| coverage | ||
| *.tsbuildinfo | ||
| next-env.d.ts | ||
| vitest.config.ts | ||
|
|
||
| # logs | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # vercel | ||
| .vercel | ||
|
|
||
| # docker | ||
| Dockerfile | ||
| .dockerignore |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # syntax=docker/dockerfile:1.7 | ||
|
|
||
| # Multi-stage build for Next.js 16 (standalone output) on Node.js 22 (Alpine). | ||
| # | ||
| # Build (Spree env required: pages are prerendered against the Spree API at build time): | ||
| # docker build \ | ||
| # --build-arg SPREE_API_URL=https://your-spree.example.com \ | ||
| # --build-arg SPREE_PUBLISHABLE_KEY=your_publishable_key \ | ||
| # -t storefront . | ||
| # | ||
| # Run: | ||
| # docker run -p 3001:3001 --env-file .env.local storefront | ||
| # | ||
| # Optional Sentry source map upload at build time (skipped when SENTRY_DSN is unset): | ||
| # docker build \ | ||
| # --build-arg SPREE_API_URL=... \ | ||
| # --build-arg SPREE_PUBLISHABLE_KEY=... \ | ||
| # --build-arg SENTRY_DSN=... \ | ||
| # --build-arg SENTRY_ORG=... \ | ||
| # --build-arg SENTRY_PROJECT=... \ | ||
| # --build-arg SENTRY_AUTH_TOKEN=... \ | ||
| # -t storefront . | ||
|
|
||
| ARG NODE_VERSION=22-alpine | ||
|
|
||
|
|
||
| # ---- deps: install production+dev dependencies for the build ---- | ||
| FROM node:${NODE_VERSION} AS deps | ||
| WORKDIR /app | ||
|
|
||
| # libc6-compat keeps a few native modules happy on Alpine (musl). | ||
| RUN apk add --no-cache libc6-compat | ||
|
|
||
| COPY package.json package-lock.json ./ | ||
| RUN --mount=type=cache,target=/root/.npm \ | ||
| npm ci --include=dev | ||
|
|
||
|
|
||
| # ---- builder: compile the Next.js app ---- | ||
| FROM node:${NODE_VERSION} AS builder | ||
| WORKDIR /app | ||
|
|
||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
| ENV NODE_ENV=production | ||
|
|
||
| # Spree API config — required at build time because the app prerenders pages | ||
| # that fetch from Spree (categories, products, etc.). | ||
| ARG SPREE_API_URL | ||
| ARG SPREE_PUBLISHABLE_KEY | ||
| ENV SPREE_API_URL=$SPREE_API_URL \ | ||
| SPREE_PUBLISHABLE_KEY=$SPREE_PUBLISHABLE_KEY | ||
|
|
||
| # Optional Sentry release/source-map upload. When SENTRY_DSN is empty, | ||
| # next.config.ts skips withSentryConfig entirely, so the build still works. | ||
| ARG SENTRY_DSN="" | ||
| ARG SENTRY_ORG="" | ||
| ARG SENTRY_PROJECT="" | ||
| ARG SENTRY_AUTH_TOKEN="" | ||
| ENV SENTRY_DSN=$SENTRY_DSN \ | ||
| SENTRY_ORG=$SENTRY_ORG \ | ||
| SENTRY_PROJECT=$SENTRY_PROJECT \ | ||
| SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN | ||
|
|
||
| COPY --from=deps /app/node_modules ./node_modules | ||
| COPY . . | ||
|
|
||
| RUN npm run build | ||
|
|
||
|
|
||
| # ---- runner: minimal runtime image ---- | ||
| FROM node:${NODE_VERSION} AS runner | ||
| WORKDIR /app | ||
|
|
||
| ENV NODE_ENV=production | ||
| ENV NEXT_TELEMETRY_DISABLED=1 | ||
| ENV PORT=3001 | ||
| ENV HOSTNAME=0.0.0.0 | ||
|
|
||
| RUN addgroup --system --gid 1001 nodejs \ | ||
| && adduser --system --uid 1001 nextjs | ||
|
|
||
| # Static assets and the standalone server bundle. | ||
| # The standalone output ships its own minimal node_modules. | ||
| COPY --from=builder --chown=nextjs:nodejs /app/public ./public | ||
| COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
| COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
|
||
| USER nextjs | ||
|
|
||
| EXPOSE 3001 | ||
|
|
||
| CMD ["node", "server.js"] | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| "use client"; | ||
|
|
||
| export function CurrentYear() { | ||
| return <>{new Date().getFullYear()}</>; | ||
| } |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.