From 41245c42deebbeee0f11d2550e091781b30156a2 Mon Sep 17 00:00:00 2001 From: sk1982 Date: Sun, 7 Apr 2024 03:59:11 -0400 Subject: [PATCH] add docker files --- .dockerignore | 11 +++++++++++ Dockerfile | 28 ++++++++++++++++++++++++++++ docker-compose.yml | 11 +++++++++++ docker-transfer-next-static.sh | 6 ++++++ 4 files changed, 56 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker-transfer-next-static.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8218537 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +Dockerfile +.dockerignore +node_modules +public/assets/* +!public/assets/fonts +.next +.git +scripts +.idea +npm-debug.log +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7f8c300 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM node:21 AS base + +FROM base AS deps +WORKDIR /app +COPY package*.json . +RUN npm ci + +FROM base AS runner +WORKDIR /app + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +ENV NODE_ENV production +ENV NEXT_TELEMETRY_DISABLED 1 +RUN npm run build +RUN node compress.mjs + +RUN chown -R nextjs:nodejs .next + +USER nextjs +EXPOSE 3000 +ENV PORT 3000 + +CMD HOSTNAME="0.0.0.0" npm run start diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..30ae8bb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + actaeon: + container_name: actaeon + build: + dockerfile: ./Dockerfile + environment: + - AUTOMIGRATE=true + - DATABASE_URL=mysql://aime:aime@127.0.0.1:3306/aime + - NEXTAUTH_SECRET=[insert_random_string_here] + ports: + - 3000:1430 diff --git a/docker-transfer-next-static.sh b/docker-transfer-next-static.sh new file mode 100644 index 0000000..f282163 --- /dev/null +++ b/docker-transfer-next-static.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +rm -rf .next +mkdir .next + +docker container cp actaeon:/app/.next/static/ .next/