From 96d6917b0bd443770a83c3a1236e3368c2ba2aa3 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 13 Aug 2026 08:44:23 +0200 Subject: [PATCH] Add Dockerfile, docker-compose and Makefile for container build --- Dockerfile | 21 +++++++++++++++++++++ Makefile | 35 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 9 +++++++++ nginx.conf | 22 ++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..69483c7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# ── Build stage ───────────────────────────────────────────────────────────── +FROM docker.io/library/node:22-alpine AS build + +WORKDIR /app + +COPY web/package.json web/package-lock.json ./ +RUN npm ci + +COPY web/ ./ +RUN npm run build + +# ── Runtime stage ─────────────────────────────────────────────────────────── +FROM docker.io/library/nginx:1.27-alpine + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 + +HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ + CMD wget -qO- http://localhost/ >/dev/null || exit 1 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a07ac87 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# ── Wackelpeter container build/deploy ────────────────────────────────────── +# Uses Podman (docker-compose optional). Targets: +# make build – Build image +# make push – Push image to Gitea registry +# make up/down – Start/stop via docker-compose +# make run – Start via podman directly +# make clean – Remove local image + +REGISTRY ?= gitea.korbel.network +IMAGE ?= $(REGISTRY)/nico/wackelpeter +TAG ?= latest +COMPOSE ?= docker-compose + +.PHONY: build push up down run clean login + +build: + podman build -t $(IMAGE):$(TAG) . + +push: build + podman push $(IMAGE):$(TAG) + +up: build + $(COMPOSE) up -d + +down: + $(COMPOSE) down + +run: build + podman run --rm -d --name wackelpeter -p 8080:80 $(IMAGE):$(TAG) + +clean: + podman rmi $(IMAGE):$(TAG) || true + +login: + podman login $(REGISTRY) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e4eee62 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + wackelpeter: + image: gitea.korbel.network/nico/wackelpeter:latest + build: + context: . + container_name: wackelpeter + ports: + - "8080:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..60ae0fb --- /dev/null +++ b/nginx.conf @@ -0,0 +1,22 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + # gzip + gzip on; + gzip_types text/css application/javascript application/json image/svg+xml; + + # GLB models and assets + location ~* \.(glb|gltf|ogg|png|jpg|json)$ { + expires 7d; + add_header Cache-Control "public"; + } + + # SPA fallback + location / { + try_files $uri $uri/ /index.html; + } +}