add runner

This commit is contained in:
Puechberty Arthur
2026-06-12 01:06:17 +02:00
parent b06d4e6844
commit 4b21254c7d
8 changed files with 75 additions and 39 deletions
+6
View File
@@ -0,0 +1,6 @@
node_modules
.next
npm-debug.log
Dockerfile
docker-compose.yml
.git
+6
View File
@@ -0,0 +1,6 @@
# Docker / Next.js
NEXT_TELEMETRY_DISABLED=1
NODE_ENV=production
HOSTNAME=0.0.0.0
PORT=3000
APP_PORT=3000
+27
View File
@@ -0,0 +1,27 @@
name: Deploy Docker
on:
push:
branches: ["main"]
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Deploy on server
run: |
set -e
echo "Go to app folder"
cd /opt/apps/hub
echo "Pull latest code"
git pull origin main
echo "Build & restart containers"
docker compose down || true
docker compose build
docker compose up -d
echo "Deploy finished"
+1
View File
@@ -35,6 +35,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed) # env files (can opt-in for committing if needed)
.env* .env*
!.env.example
# vercel # vercel
.vercel .vercel
+16 -14
View File
@@ -1,26 +1,28 @@
FROM node:22-alpine AS base # ===== BUILD =====
WORKDIR /app FROM node:20-alpine AS builder
ENV NEXT_TELEMETRY_DISABLED=1
FROM base AS deps WORKDIR /app
COPY package.json package-lock.json ./
COPY package*.json ./
RUN npm ci RUN npm ci
FROM deps AS dev
COPY . . COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev", "--", "--hostname", "0.0.0.0", "--port", "3000"]
FROM deps AS builder
COPY . .
RUN npm run build RUN npm run build
FROM base AS runner
# ===== RUN =====
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000 # Standalone output
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
EXPOSE 3000 EXPOSE 3000
CMD ["node", "server.js"] CMD ["node", "server.js"]
+15 -24
View File
@@ -1,31 +1,22 @@
services: services:
hub-dev: visio:
profiles: ["dev"]
build: build:
context: . context: .
target: dev dockerfile: Dockerfile
container_name: hub-dev
ports: container_name: visio
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
- /app/.next
environment:
NEXT_TELEMETRY_DISABLED: "1"
NODE_ENV: development
hub-prod:
profiles: ["prod"]
build:
context: .
target: runner
container_name: hub-prod
restart: unless-stopped
ports: ports:
- "3004:3000" - "${APP_PORT}:3000"
env_file: env_file:
- .env - .env
environment:
NEXT_TELEMETRY_DISABLED: "1" restart: unless-stopped
NODE_ENV: production
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
+2
View File
@@ -9,6 +9,8 @@ const nextConfig: NextConfig = {
// Compression des pages côté serveur (gzip/brotli) // Compression des pages côté serveur (gzip/brotli)
compress: true, compress: true,
poweredByHeader: false,
}; };
export default nextConfig; export default nextConfig;
+2 -1
View File
@@ -5,7 +5,8 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "node .next/standalone/server.js",
"docker": "docker compose up --build",
"lint": "eslint" "lint": "eslint"
}, },
"dependencies": { "dependencies": {