From b3aece1e41ec00111f469ac0b80a3a7c3ae11654 Mon Sep 17 00:00:00 2001 From: "Ema P." Date: Wed, 10 Dec 2025 10:52:36 -0500 Subject: [PATCH 1/6] Adding next.config.js for standalone. --- next.config.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 next.config.js diff --git a/next.config.js b/next.config.js new file mode 100644 index 0000000..f307dcb --- /dev/null +++ b/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + output: 'standalone', +}; + +module.exports = nextConfig; \ No newline at end of file From e6e230ab84b7fcf63ab9e690d7184ab3d8f7f16a Mon Sep 17 00:00:00 2001 From: "Ema P." Date: Wed, 10 Dec 2025 10:55:35 -0500 Subject: [PATCH 2/6] Building image from .next standalone server. --- dockerfile | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/dockerfile b/dockerfile index 06ce342..3146df0 100644 --- a/dockerfile +++ b/dockerfile @@ -1,7 +1,5 @@ FROM node:22-alpine AS base - WORKDIR /app - FROM base AS deps COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* ./ RUN \ @@ -12,23 +10,19 @@ RUN \ fi FROM base AS builder +WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build -FROM base AS runner -ENV NODE_ENV=production - -RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs - +FROM node:22-alpine AS runner WORKDIR /app - +RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/package.json ./package.json USER nextjs EXPOSE 3000 -CMD ["npm", "start"] +CMD ["node", "server.js"] \ No newline at end of file From a02087915b755d3ac961cb211ba919143324d3f7 Mon Sep 17 00:00:00 2001 From: "Ema P." <> Date: Wed, 10 Dec 2025 12:38:10 -0500 Subject: [PATCH 3/6] Standalone Readme Editing --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b578205..7722817 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # Sucker -Check package.json for commands, I can't be bothered. +Standalone branch for next and Docker. This branch adds `next.config.js` along with changes to `dockerfile` to build Sucker with only the required dependencies and server components. + +It is intended to build and run Sucker through Docker. Pull this repository and run `docker build -t .` and `docker compose up` in the project directory. The container will expose the next server on port 3000; this can be changed in `docker-compose.yml` as needed. + +If for whatever reason you want to build and run this branch on the host, build with `npm run build` and start the server with `node ./.next/standalone/server.js` + +Todo: Publish to GHCR(?) ### Changelog From 8923bf3f639b48821b488074f6657b76b8d5842b Mon Sep 17 00:00:00 2001 From: Severian Date: Thu, 11 Dec 2025 08:42:20 +0800 Subject: [PATCH 4/6] chore: prod env, no sourcemaps --- dockerfile | 3 +++ next-env.d.ts | 2 +- next.config.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index 3146df0..5cfbad5 100644 --- a/dockerfile +++ b/dockerfile @@ -11,6 +11,9 @@ RUN \ FROM base AS builder WORKDIR /app + +ENV NODE_ENV=production + COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build diff --git a/next-env.d.ts b/next-env.d.ts index c4b7818..9edff1c 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/next.config.js b/next.config.js index f307dcb..a28ddc8 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { output: 'standalone', + productionBrowserSourceMaps: false, }; module.exports = nextConfig; \ No newline at end of file From fdd13085c358a27971355196a2d63b58a3f09cc6 Mon Sep 17 00:00:00 2001 From: Ema Date: Wed, 10 Dec 2025 22:31:54 -0500 Subject: [PATCH 5/6] Removing runtime env --- docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5825ff5..4e67f7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,4 @@ services: build: . image: sucker ports: - - "3000:3000" - environment: - NODE_ENV: production + - "3000:3000" \ No newline at end of file From 59acc534faa8faa2eb8372b971fcc5434fbe83d3 Mon Sep 17 00:00:00 2001 From: Ema Date: Wed, 10 Dec 2025 22:34:29 -0500 Subject: [PATCH 6/6] Cleaning readme. --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7722817..7df0aad 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # Sucker -Standalone branch for next and Docker. This branch adds `next.config.js` along with changes to `dockerfile` to build Sucker with only the required dependencies and server components. +### Usage -It is intended to build and run Sucker through Docker. Pull this repository and run `docker build -t .` and `docker compose up` in the project directory. The container will expose the next server on port 3000; this can be changed in `docker-compose.yml` as needed. +Pull this repostory and build with `npm run build`. You can start the server with `node ./.next/standalone/server.js` -If for whatever reason you want to build and run this branch on the host, build with `npm run build` and start the server with `node ./.next/standalone/server.js` - -Todo: Publish to GHCR(?) +You can also build and run Sucker as a Docker container with `docker compose build` and `docker compose up`. ### Changelog