Files
kuentagym/web/Dockerfile
T
Duarte Santos f94fa7c0e3 Umzug nach gitea.com: Images, Klon-URL, Anlaufstellen und CI umgestellt
Das GitHub-Repo ist mit dem gesperrten Account weg, mit ihm die GHCR-Images, die
Pages-Demo und die Discussions. Alles, was jemand zum Selbsthosten anklickt, zeigte
aber weiter dorthin.

- docker-compose zieht jetzt gitea.com/duartesantos/opengym-{api,web}; die
  Dockerfile-Labels (source/url/documentation) ebenso
- README, SECURITY, CONTRIBUTING und docs/SELF_HOSTING zeigen auf gitea.com.
  Discussions gibt es dort nicht: Fragen und Ideen laufen als gelabelte Issues,
  Security-Meldungen ueber eine Issue-Anfrage nach einem privaten Kanal statt
  ueber GitHubs Advisories
- Badges auf die Gitea-Shields umgestellt, die tote Pages-Demo aus dem Kopf
  genommen (die APK bleibt der Weg zum Ausprobieren)
- .gitea/workflows: Tests und Docker-Publish, weiter mit Release- statt
  Tag-Trigger. Kein type=gha-Cache, den gibt es auf den Gitea-Runnern nicht;
  der Push braucht ein Repo-Secret PACKAGES_TOKEN mit write:package
- .gitea/ISSUE_TEMPLATE mit denselben Formularen wie auf GitHub
- .github/* bleibt unangetastet, falls der Account zurueckkommt

Die alten Issue-/PR-Nummern im CHANGELOG bleiben als reiner Text stehen - sie
zeigen auf ein totes Repo und passen nicht auf die Nummerierung hier.
2026-08-22 13:54:26 +02:00

51 lines
2.4 KiB
Docker

# Multi-stage: build the React app, then serve it with nginx.
# Self-hosters never need Node locally — `docker compose up` builds everything.
#
# --platform=$BUILDPLATFORM pins the build stage to the host's native arch even when
# cross-building for other targets (e.g. amd64 host building an arm64 image). The build
# output (static JS/CSS/HTML) is arch-independent, so there's no reason to run it under
# QEMU — and QEMU-emulated npm installs are known to corrupt esbuild/rollup's platform-
# specific native binaries, which is what breaks `vite build` with unrelated-looking
# module-resolution errors.
FROM --platform=$BUILDPLATFORM node:22-alpine AS build
WORKDIR /app
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci 2>/dev/null || npm install
COPY frontend/ ./
RUN npm run build
FROM nginx:alpine
ARG VERSION=dev
ARG VCS_REF=dev
ARG BUILD_DATE=unknown
LABEL maintainer="Duarte Santos https://gitea.com/DuarteSantos" \
org.opencontainers.image.title="opengym-web" \
org.opencontainers.image.description="Frontend for Self-hosted gym & body-weight tracker — plan routines, log workouts (supersets & cardio too), track your weight and progress, passkey login. Your data, your server." \
org.opencontainers.image.source="https://gitea.com/DuarteSantos/openGym" \
org.opencontainers.image.url="https://gitea.com/DuarteSantos/-/packages/container/opengym-web" \
org.opencontainers.image.documentation="https://gitea.com/DuarteSantos/openGym#readme" \
org.opencontainers.image.licenses="AGPL-3.0-or-later" \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
COPY web/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /app/dist /usr/share/nginx/html
# exercise media (img/gif) is mounted at runtime from the media volume
# Set Default ENVs for nginx
ENV NGINX_PORT=80
ENV BACKEND=api
ENV PORT=3000
# Probe the port nginx was actually told to listen on (NGINX_PORT is configurable, so a
# hardcoded http://localhost/ breaks on any instance that changed it), and address it as
# 127.0.0.1: envsubst rewrites the conf after the image's IPv6 script, so nginx ends up
# listening on IPv4 only while "localhost" resolves to ::1 first.
HEALTHCHECK --interval=5m \
--timeout=5s \
--retries=3 \
CMD wget --spider -q "http://127.0.0.1:${NGINX_PORT}/" || exit 1