commit acbb7e92aab89be8182c50309f6defe98a032da3 Author: gitea_admin Date: Mon Oct 5 19:18:59 2026 +0200 Example: a Dockerfile and the workflow that publishes it diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..f95ede8 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,41 @@ +# Builds the Dockerfile at the root for every v* tag and pushes it to this forge's staging registry. +# IPCR picks it up from there within a minute and publishes it on IPFS; the forge's page then +# lists the exact `image:` line to use. +# +# Differences from a GitHub-hosted workflow, all needed on this forge: +# login to localhost:5000 the staging registry, as this repository: IPCR_PUSH_TOKEN is a secret +# the forge sets on every repository allowed to publish +# images: localhost:5000/… this repository's own name there (no other is accepted) +# network=host so buildx's builder can reach that registry +# runs-on: ipcr the forge's own runner, the one that sees that registry (a Gitea app's +# own runner, if there is one, does not) +name: image +on: + push: + tags: ['v*'] +jobs: + image: + runs-on: ipcr + steps: + - uses: actions/checkout@v4 + - uses: docker/login-action@v3 + with: + registry: localhost:5000 + username: ${{ github.repository }} + password: ${{ secrets.IPCR_PUSH_TOKEN }} + - uses: docker/metadata-action@v5 + id: meta + with: + images: localhost:5000/${{ github.repository }} + tags: | + type=semver,pattern={{version}} + type=raw,value=latest + - uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host + - uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..312c58e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +# A one-page web server: busybox httpd on port 8080, as an unprivileged user. +FROM busybox:1.37 +COPY index.html /www/index.html +USER 1000:1000 +EXPOSE 8080 +CMD ["httpd", "-f", "-p", "8080", "-h", "/www"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e27509 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# ipcr-hello + +The IPCR Forge example. A tag on this repository builds its image, IPCR publishes it on IPFS, +and the repository is mirrored to Radicle. + +## Try it + +1. **Tag a release.** In Gitea: *Tags → New tag* (or *Releases → New release*), name it `v1.0.0` + and target `main`. From a clone it works too: + + ```sh + git tag v1.0.0 && git push origin v1.0.0 + ``` + +2. **Watch the build** under *Actions*. The first build on a new server takes a few minutes more, + while it downloads its build images. + +3. **Find the image** on the forge's page (`ipcr-forge-`, *Published images*), about + a minute after the build finishes. Then on this server or on any other running IPCR: + + ```yaml + services: + hello: + image: ipcr.localhost:4767/ipns//gitea_admin/ipcr-hello:1.0.0 + ports: ["8080:8080"] + ``` + +## What makes it work + +- [`.gitea/workflows/build.yml`](.gitea/workflows/build.yml) pushes to `localhost:5000`, the + forge's staging registry. IPCR imports every tag it finds there. +- [`Dockerfile`](Dockerfile) is an ordinary Dockerfile. Anything that builds works. + +Copy the workflow into any public or private repository on this forge to publish it the same way. diff --git a/index.html b/index.html new file mode 100644 index 0000000..77137dc --- /dev/null +++ b/index.html @@ -0,0 +1,9 @@ + + +ipcr-hello + +

Hello from IPFS

+

This page is served by a container whose image was built by IPCR Forge and pulled from IPFS +through IPCR.

+ +