feat(docker): disable Next.js telemetry in containerized deployments

- Add NEXT_TELEMETRY_DISABLED=1 to Dockerfile (builder and runner stages)
- Add NEXT_TELEMETRY_DISABLED=1 to docker-compose.yml
- Add build-args to GitHub Actions workflow
- Document environment variables in README

This ensures no telemetry data is collected from containerized
deployments, respecting user privacy and reducing network overhead.
This commit is contained in:
retrozenith
2025-12-28 13:08:47 +02:00
parent c4f7519a3b
commit 450d692d5b
4 changed files with 26 additions and 1 deletions

View File

@@ -63,6 +63,8 @@ jobs:
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
NEXT_TELEMETRY_DISABLED=1
- name: Image digest - name: Image digest
run: echo ${{ steps.meta.outputs.digest }} run: echo ${{ steps.meta.outputs.digest }}

View File

@@ -13,6 +13,9 @@ RUN npm ci --only=production && \
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
# Disable Next.js telemetry during build
ENV NEXT_TELEMETRY_DISABLED=1
# Copy package files # Copy package files
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
@@ -31,6 +34,8 @@ WORKDIR /app
# Set environment to production # Set environment to production
ENV NODE_ENV=production ENV NODE_ENV=production
# Disable Next.js telemetry
ENV NEXT_TELEMETRY_DISABLED=1
# Create non-root user for security # Create non-root user for security
RUN addgroup --system --gid 1001 nodejs && \ RUN addgroup --system --gid 1001 nodejs && \

View File

@@ -131,6 +131,23 @@ The Docker container exposes port 3000 by default. You can customize the port ma
docker run -p 8080:3000 tuxmate:latest docker run -p 8080:3000 tuxmate:latest
``` ```
### Environment Variables
The following environment variables are configured by default:
- `NODE_ENV=production` - Run in production mode
- `PORT=3000` - Application port
- `NEXT_TELEMETRY_DISABLED=1` - Disable Next.js anonymous telemetry
You can override these when running the container:
```bash
docker run -p 3000:3000 \
-e PORT=3000 \
-e NEXT_TELEMETRY_DISABLED=1 \
tuxmate:latest
```
</details> </details>

View File

@@ -5,13 +5,14 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
image: tuxmate:latest image: ghcr.io/retrozenith/tuxmate:latest
container_name: tuxmate container_name: tuxmate
ports: ports:
- "3000:3000" - "3000:3000"
environment: environment:
- NODE_ENV=production - NODE_ENV=production
- PORT=3000 - PORT=3000
- NEXT_TELEMETRY_DISABLED=1
restart: unless-stopped restart: unless-stopped
healthcheck: healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000"] test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000"]