Add Dockerfile, docker-compose and Makefile for container build
This commit is contained in:
+21
@@ -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
|
||||||
@@ -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)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
wackelpeter:
|
||||||
|
image: gitea.korbel.network/nico/wackelpeter:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
container_name: wackelpeter
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
restart: unless-stopped
|
||||||
+22
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user