add runner

This commit is contained in:
Puechberty Arthur
2026-06-12 01:26:06 +02:00
parent e748b75a4b
commit 74ecd21eda
8 changed files with 89 additions and 32 deletions
+6
View File
@@ -0,0 +1,6 @@
node_modules
.next
npm-debug.log
Dockerfile
docker-compose.yml
.git
+9
View File
@@ -3,3 +3,12 @@ NEXT_PUBLIC_BASE_URL=https://reducelink.arthurp.fr
# Base de données SQLite
DATABASE_URL="file:./dev.db"
# Port exposé côté machine
APP_PORT=3000
# Node environment
NODE_ENV=production
# Next.js
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/reducelink
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"
+28
View File
@@ -0,0 +1,28 @@
# ===== BUILD =====
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# ===== RUN =====
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Standalone output
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
CMD ["node", "server.js"]
-19
View File
@@ -1,19 +0,0 @@
services:
reducelink:
image: node:20-alpine
container_name: reducelink
working_dir: /app
volumes:
- .:/app
- node_modules:/app/node_modules
ports:
- "3000:3000"
environment:
- NODE_ENV=development
- DATABASE_URL=file:./prisma/dev.db
- NEXT_PUBLIC_BASE_URL=http://localhost:3000
command: sh -c "npm install && npx prisma generate && npx prisma migrate dev --name init && npm run dev"
restart: unless-stopped
volumes:
node_modules:
+16 -12
View File
@@ -1,18 +1,22 @@
services:
reducelink:
image: node:20-alpine
build:
context: .
dockerfile: Dockerfile
container_name: reducelink
working_dir: /app
volumes:
- .:/app
- node_modules:/app/node_modules
ports:
- "3006:3000"
environment:
- DATABASE_URL=file:./dev.db
- NEXT_PUBLIC_BASE_URL=https://reducelink.arthurp.fr
command: sh -c "apk add --no-cache openssl libc6-compat && npm install && npx prisma generate && npx prisma migrate deploy && npm run build && npm run start"
- "${APP_PORT}:3000"
env_file:
- .env
restart: unless-stopped
volumes:
node_modules:
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
+1
View File
@@ -3,6 +3,7 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = {
compress: true,
poweredByHeader: false,
output: "standalone",
async headers() {
return [
{
+2 -1
View File
@@ -5,7 +5,8 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"start": "node .next/standalone/server.js",
"docker": "docker compose up --build",
"lint": "eslint"
},
"dependencies": {