33 lines
1.1 KiB
Makefile
33 lines
1.1 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/')
|
|
repo_url := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|'")
|
|
|
|
pipeline_file := shell('mktemp')
|
|
|
|
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}} \
|
|
{{args}}
|
|
|
|
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}}
|
|
|
|
set-pipeline: (make-pipeline pipeline_file)
|
|
fly -t {{target}} set-pipeline \
|
|
--pipeline {{pipeline_name}} \
|
|
--config "{{pipeline_file}}" \
|
|
-v registry_url={{registry_url}} \
|
|
-v repo_url={{repo_url}}
|