Some checks failed
build/base Building image base
build/fluentd Building image fluentd
build/forgejo Building image forgejo
build/frp Building image frp
build/node-script Building image node-script
build/python-script Building image python-script
build/mx-puppet-steam Building image mx-puppet-steam
build/fava Building image fava
build/caddy Building image caddy
build/lua-clib Building image lua-clib
build/nextcloud Building image nextcloud
build/gotenberg Building image gotenberg
build/gitea Building images gitea-package, gitea-pr, gitea-status
build/ruby-script Building image ruby-script
build/rust-xwin Building image rust-xwin
73 lines
2.8 KiB
Makefile
73 lines
2.8 KiB
Makefile
pipeline_name := 'ci-images'
|
|
target := 'main'
|
|
|
|
# Internal endpoint of the Docker registry, where no authentication is necessary
|
|
registry_url := env_var_or_default('REGISTRY_URL', 'docker.io/')
|
|
registry_mirror_url := env_var_or_default('REGISTRY_MIRROR_URL', '')
|
|
forgejo_api_key := env_var("FORGEJO_API_KEY")
|
|
forgejo_url := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|' | cut -d'/' -f-3")
|
|
repo_owner := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|' | cut -d'/' -f4")
|
|
repo_name := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|' | cut -d'/' -f5-")
|
|
|
|
pipeline_file := shell('mktemp')
|
|
|
|
buildkit_config_tmpl := '''
|
|
[registry."docker.io"]
|
|
mirrors = ["{{registry_mirror_url}}"]
|
|
|
|
[registry."{{registry_mirror_url}}"]
|
|
http = true
|
|
'''
|
|
buildkit_config := replace(buildkit_config_tmpl, "{{registry_mirror_url}}", registry_mirror_url)
|
|
|
|
build context dockerfile='' image_target='' *args='':
|
|
fly -t {{target}} execute \
|
|
--config=./tasks/build-image.yml \
|
|
--privileged \
|
|
-i repo=. \
|
|
-o image=/tmp/build-image \
|
|
-v context=repo/images/{{context}} \
|
|
-v dockerfile={{dockerfile}} \
|
|
-v target={{image_target}} \
|
|
-v registry_url={{registry_url}} \
|
|
-v 'buildkit_config={{buildkit_config}}' \
|
|
-v image_platform= \
|
|
{{args}}
|
|
@echo "$(tput bold)Image built and downloaded to /tmp/build-image/. You can import it with 'docker image import /tmp/build-image/image.tar <tag>'$(tput sgr0)"
|
|
|
|
make-pipeline file:
|
|
jinja2 --strict --outfile="{{file}}" pipelines/build-and-push.yml.j2 pipelines/build-and-push.json
|
|
fly -t {{target}} validate-pipeline \
|
|
--strict \
|
|
--config "{{file}}" \
|
|
-v registry_url={{registry_url}} \
|
|
-v 'buildkit_config={{buildkit_config}}' \
|
|
-v forgejo_api_key={{forgejo_api_key}} \
|
|
-v forgejo_url={{forgejo_url}} \
|
|
-v repo_owner={{repo_owner}} \
|
|
-v repo_name={{repo_name}}
|
|
|
|
set-pipeline: (make-pipeline pipeline_file)
|
|
fly -t {{target}} set-pipeline \
|
|
--pipeline {{pipeline_name}} \
|
|
--config "{{pipeline_file}}" \
|
|
-v registry_url={{registry_url}} \
|
|
-v 'buildkit_config={{buildkit_config}}' \
|
|
-v forgejo_api_key={{forgejo_api_key}} \
|
|
-v forgejo_url={{forgejo_url}} \
|
|
-v repo_owner={{repo_owner}} \
|
|
-v repo_name={{repo_name}}
|
|
|
|
validate:
|
|
docker run --rm -v ./:/usr/src/app renovate/renovate renovate-config-validator --strict
|
|
|
|
renovate *args='':
|
|
docker run --rm -t \
|
|
-v ./:/usr/src/app \
|
|
-e LOG_FORMAT=pretty \
|
|
-e LOG_LEVEL=debug \
|
|
renovate/renovate \
|
|
--platform=local \
|
|
--github-token-warn=false \
|
|
{{args}} \
|
|
|& bat
|