commit 4501a08675a7dc1e04bb27f3adb11a25dc6b4c34 Author: Michael Czechowski Date: Wed Apr 29 17:48:54 2026 +0200 feat: extract nginx from mp/nginx — initial libreshop/nginx Source moved verbatim from mp/nginx/ on 2026-04-29; mp was the first concrete adapter consuming the libreshop toolkit. Builds and publishes git.librete.ch/libreshop/nginx on every main / v* push via the standard .gitea/workflows/build.yml shared across libreshop components. diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..95ab97e --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,55 @@ +name: Build and publish + +on: + push: + branches: [main] + tags: ["v*"] + pull_request: + branches: [main] + +# Required secrets: +# REGISTRY git.librete.ch +# REGISTRY_USER libretech-bot +# REGISTRY_PASS bot PAT (write:package; bot is in libreshop Owners team) +# Required variable: +# PUBLISH_ENABLED "true" to actually push (off = build-only on PRs) +# +# Image: git.librete.ch/libreshop/nginx +# main pushes → :main + :sha- +# tag pushes → : + :latest + +jobs: + build: + runs-on: ubuntu-latest + container: + image: git.librete.ch/libretech/runner-image:v1 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + + - uses: docker/setup-buildx-action@v3 + + - name: Login (only when publishing) + if: ${{ vars.PUBLISH_ENABLED == 'true' }} + uses: docker/login-action@v3 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASS }} + + - id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.REGISTRY }}/libreshop/nginx + tags: | + type=ref,event=branch + type=ref,event=tag + type=sha,format=short + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} + + - uses: docker/build-push-action@v6 + with: + context: . + push: ${{ vars.PUBLISH_ENABLED == 'true' && github.event_name == 'push' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29fe6f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +logs +cache + +# libreshop additions +.env +.env.local +.env.*.local +node_modules/ +.nuxt/ +.output/ +.cache/ +.parcel-cache/ +dist/ +build/ +coverage/ +logs/ +tmp/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..56bcda7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +All notable changes to libreshop/nginx are documented here. + +## Unreleased + +- Extracted from `mp/nginx/` (2026-04-29). The component history before + the extraction lives in the `muellerprints` repository. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e70e6ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +# Libre Shop - (Reverse) Proxy +# Version 1.0.0 + +FROM nginx:1.26.2 + +COPY docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh + +CMD ["/docker-entrypoint.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..9df6dbe --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# libreshop/nginx + +Reverse-proxy template fronting libreshop adapters. + +Part of the [libreshop](https://git.librete.ch/libreshop) toolkit. Image +published at `git.librete.ch/libreshop/nginx` on every push to `main` +and on `v*` tags. + +## Source + +This repo was extracted from `mp/nginx/` on 2026-04-29; mp was the +first concrete adapter consuming the toolkit. mp's `compose.yml` now +pulls `git.librete.ch/libreshop/nginx:` instead of building locally. + +## Build locally + +``` +docker build -t libreshop/nginx:dev . +``` + +## Adapter contract + +See `docker-entrypoint.sh` and `Dockerfile` for the runtime surface. +Adapters configure the component via env vars and bind-mounted volumes; +do not patch the running container or rely on internal paths. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..0d9549f --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -e + +echo "Generated nginx.conf:" +echo "" +cat /etc/nginx/nginx.conf + +mkdir -p /cache/shop +mkdir -p /cache/uploads +mkdir -p /cache/api + +echo "Starting nginx" +echo "NGINX_DEBUG=${NGINX_DEBUG}" +# Start Nginx +if [ "$NGINX_DEBUG" = "true" ]; then + sed -i 's/error\.log warn/error.log debug/' /etc/nginx/nginx.conf + exec nginx-debug -g 'daemon off;' +else + exec nginx -g 'daemon off;' +fi