From a03bfe858e161bd1ba897d519ae4432853a92982 Mon Sep 17 00:00:00 2001 From: madflow Date: Fri, 14 Jul 2023 19:01:21 +0200 Subject: [PATCH] add minimal docker setup --- .dockerignore | 7 +++++++ Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c5500558 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..de455a5f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM node:16-bookworm AS base + +FROM base AS deps + +RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY package.json yarn.lock* ./ +RUN yarn --frozen-lockfile + +FROM base AS builder + +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +ENV NEXT_TELEMETRY_DISABLED 1 +RUN yarn run build + +FROM base AS runner + +WORKDIR /app + +RUN adduser --uid 1001 nextjs + +COPY --from=builder --chown=nextjs:node /app/ /app/ + +ENV NEXT_TELEMETRY_DISABLED 1 +ENV NODE_ENV production + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 + +CMD ["yarn", "run", "start"]