From 2c41ab9240b15cc25a7480e12637c283976757ea Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 4 Sep 2025 23:31:03 +0200 Subject: [PATCH] Added docker files --- .dockerignore | 14 ++++++++++++++ Dockerfile | 18 ++++++++++++++++++ docker-compose.yml | 13 +++++++++++++ package.json | 1 + 4 files changed, 46 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3af6c75 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.git +.next +node_modules +.dockerignore +.env +.envrc +.gitignore +.npmrc +AGENTS.md +api.http +components.json +docker-compose.yml +Dockerfile +dprint.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7cb5b96 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM oven/bun AS base + +WORKDIR /app +RUN apk add --no-cache libc6-compat +COPY package.json bun.lock ./ +RUN bun i --frozen-lockfile +COPY . . +ENV NEXT_TELEMETRY_DISABLED=1 +ENV NODE_ENV=production + +RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs && chown -R nextjs:nodejs . + +USER nextjs +EXPOSE 3000 +ENV PORT=3000 +ENV HOSTNAME="0.0.0.0" + +CMD ["bun", "container:build"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b9fb282 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +--- +services: + stats-hypixel: + build: + context: . + dockerfile: Dockerfile + container_name: stats-hypixel + restart: unless-stopped + ports: + - 3000:3000 + environment: + - MAINTENANCE_MODE=${MAINTENANCE_MODE} + - HYPIXEL_API_KEY=${HYPIXEL_API_KEY} diff --git a/package.json b/package.json index 065a4c0..a242207 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "next dev --turbopack", "build": "next build --turbopack", + "container:build": "bun run build && bun start", "start": "next start", "typegen": "next typegen", "lint": "eslint .",