diff --git a/.editorconfig b/.editorconfig index 5d47c21..da09250 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,6 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.py] +indent_size = 4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfd717a..8dbeb2a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,15 @@ repos: hooks: - id: generate-readme name: Generate README - entry: python generate-readme.py + entry: python scripts/generate-readme.py language: python pass_filenames: false files: ^images\.json$ + - id: generate-build-pipeline + name: Generate build pipeline + entry: python scripts/generate-build-pipeline.py + language: python + pass_filenames: false + files: ^images\.json$ + additional_dependencies: + - pyyaml diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..ec871f0 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,44 @@ +# GENERATED CODE - DO NOT MODIFY BY HAND +steps: +- directory: ./beeper_bridge-manager + image: woodpeckerci/plugin-docker-buildx + name: publish beeper_bridge-manager + settings: + dockerfile: ./docker/Dockerfile + password: + from_secret: docker_token + platforms: linux/amd64,linux/arm64 + registry: git.jakew.me + repo: git.jakew.me/${CI_REPO_OWNER}/beeper_bridge-manager + tags: latest + username: ${CI_REPO_OWNER} +- directory: ./matterbridge + image: woodpeckerci/plugin-docker-buildx + name: publish matterbridge_whatsappmulti + settings: + dockerfile: ./Dockerfile_whatsappmulti + password: + from_secret: docker_token + platforms: linux/amd64,linux/arm64 + registry: git.jakew.me + repo: git.jakew.me/${CI_REPO_OWNER}/matterbridge_whatsappmulti + tags: latest + username: ${CI_REPO_OWNER} +- directory: ./custom-caddy + image: woodpeckerci/plugin-docker-buildx + name: publish custom-caddy + settings: + dockerfile: ./Dockerfile + password: + from_secret: docker_token + platforms: linux/amd64,linux/arm64 + registry: git.jakew.me + repo: git.jakew.me/${CI_REPO_OWNER}/custom-caddy + tags: latest + username: ${CI_REPO_OWNER} +when: +- branch: ${CI_REPO_DEFAULT_BRANCH} + event: push +- event: manual +- cron: weekly + event: cron diff --git a/.woodpecker/pre-commit.yaml b/.woodpecker/pre-commit.yaml new file mode 100644 index 0000000..c419ff2 --- /dev/null +++ b/.woodpecker/pre-commit.yaml @@ -0,0 +1,11 @@ +when: + - event: [push, pull_request, manual] + +steps: + - name: pre-commit + image: python:alpine + commands: + - apk add --update --no-cache git + - pip install --root-user-action ignore pre-commit + - ls -lah + - pre-commit run --all-files diff --git a/README.md b/README.md index 45e42bf..b98e24e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ These are some custom images that are regularly built for AMD64 and ARM64 archit | Name | Description | | --- | --- | | `ghcr.io/jake-walker/beeper_bridge-manager` | This is an exact build of Beeper's [bridge-manager](https://github.com/beeper/bridge-manager) but with an ARM64 build. | -| `ghcr.io/jake-walker/gitea-jupyter` | This is the default Gitea image with a Jupyter notebook renderer installed. [Extra configuration](https://blog.gitea.com/render-jupyter-notebooks/#configuring-gitea-to-use-the-converter) is required to enable this. | | `ghcr.io/jake-walker/matterbridge_whatsappmulti` | A build of the matterbridge WhatsApp multi image. | | `ghcr.io/jake-walker/custom-caddy` | A custom build of Caddy with the plugins: [WebDAV](https://github.com/mholt/caddy-webdav), [replace_response handler](https://github.com/caddyserver/replace-response), [cloudflare](https://github.com/caddy-dns/cloudflare). | diff --git a/gitea-jupyter/Dockerfile b/gitea-jupyter/Dockerfile deleted file mode 100644 index e79192f..0000000 --- a/gitea-jupyter/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM gitea/gitea:latest - -RUN apk add --update --no-cache py-pip \ - && pip install --no-cache-dir --break-system-packages nbconvert diff --git a/images.json b/images.json index c621281..85ec20b 100644 --- a/images.json +++ b/images.json @@ -2,25 +2,19 @@ { "name": "beeper_bridge-manager", "context": "./beeper_bridge-manager", - "dockerfile": "./beeper_bridge-manager/docker/Dockerfile", + "dockerfile": "./docker/Dockerfile", "description": "This is an exact build of Beeper's [bridge-manager](https://github.com/beeper/bridge-manager) but with an ARM64 build." }, - { - "name": "gitea-jupyter", - "context": "./gitea-jupyter", - "dockerfile": "./gitea-jupyter/Dockerfile", - "description": "This is the default Gitea image with a Jupyter notebook renderer installed. [Extra configuration](https://blog.gitea.com/render-jupyter-notebooks/#configuring-gitea-to-use-the-converter) is required to enable this." - }, { "name": "matterbridge_whatsappmulti", "context": "./matterbridge", - "dockerfile": "./matterbridge/Dockerfile_whatsappmulti", + "dockerfile": "./Dockerfile_whatsappmulti", "description": "A build of the matterbridge WhatsApp multi image." }, { "name": "custom-caddy", "context": "./custom-caddy", - "dockerfile": "./custom-caddy/Dockerfile", + "dockerfile": "./Dockerfile", "description": "A custom build of Caddy with the plugins: [WebDAV](https://github.com/mholt/caddy-webdav), [replace_response handler](https://github.com/caddyserver/replace-response), [cloudflare](https://github.com/caddy-dns/cloudflare)." } ] diff --git a/scripts/generate-build-pipeline.py b/scripts/generate-build-pipeline.py new file mode 100644 index 0000000..7c00280 --- /dev/null +++ b/scripts/generate-build-pipeline.py @@ -0,0 +1,37 @@ +import json + +import yaml + +with open("images.json", "r") as f: + images_data = json.load(f) + +with open(".woodpecker/build.yaml", "w") as f: + f.write("# GENERATED CODE - DO NOT MODIFY BY HAND\n") + yaml.dump( + { + "when": [ + {"event": "push", "branch": "${CI_REPO_DEFAULT_BRANCH}"}, + {"event": "manual"}, + {"event": "cron", "cron": "weekly"}, + ], + "steps": [ + { + "name": f"publish {image['name']}", + "image": "woodpeckerci/plugin-docker-buildx", + "settings": { + "repo": f"git.jakew.me/${{CI_REPO_OWNER}}/{image['name']}", + "registry": "git.jakew.me", + "dockerfile": image["dockerfile"], + "platforms": "linux/amd64,linux/arm64", + "tags": "latest", + "username": "${CI_REPO_OWNER}", + "password": {"from_secret": "docker_token"}, + }, + "directory": image["context"], + } + for image in images_data + ], + }, + f, + default_flow_style=False, + ) diff --git a/generate-readme.py b/scripts/generate-readme.py similarity index 100% rename from generate-readme.py rename to scripts/generate-readme.py