Compare commits

...

23 commits

Author SHA1 Message Date
f7d3e95ef0
Check upstream image every 6h. 2024-03-16 10:49:08 +01:00
03513ee320
Remove mention of docker hub. 2022-08-30 17:30:04 +02:00
6d22bb3c51
Change quoting on output archive. 2022-08-29 18:15:09 +02:00
9bc8d05101
Update readme.md. 2022-08-29 18:04:26 +02:00
92f27c55a5
Remove docker login logic. 2022-08-29 18:03:08 +02:00
37fabc96ee
Remove unneeded parameters. 2022-08-29 18:01:26 +02:00
3641832ce8
Remove push flag, output as oci tarball. 2022-08-29 16:17:02 +02:00
7103d4760d
Change path of docker hub login. 2022-03-10 14:17:01 +01:00
9fd0228d87
Add support for other registries. 2022-03-10 13:51:06 +01:00
37efbb26ab
Add tags to pipeline config. 2022-03-09 17:44:22 +01:00
9c2c8b9b09
have latest tag at end.
It gets pushed last and shows up as the first item in docker hub.
2022-03-09 17:38:40 +01:00
5ca19483fa
Switch to new build method. 2022-03-09 16:43:29 +01:00
4a5bfd6027
Improve readme formatting. 2022-03-09 16:40:28 +01:00
18896f8e40
Add description for other params. 2022-03-09 16:37:41 +01:00
3da633753e
Alias entrypoint.sh to build. 2022-03-09 16:37:09 +01:00
306ebb6e49
Fix arguments of buildctl. 2022-03-09 16:25:35 +01:00
36f0e3414f
Fix condition for additional_tags. 2022-03-09 16:17:48 +01:00
57b283703e
Add debug echo. 2022-03-09 16:09:23 +01:00
539064d050
Fix formatting of ci/pipeline.yml. 2022-03-09 16:06:51 +01:00
7cb4bda424
Add more configurations. 2022-03-09 16:02:03 +01:00
572e0d27bc
Add automatic build after upstream moby/buildkit updates. 2022-03-09 14:58:13 +01:00
2b7cbe1f94
Add ci, update README add dockerignore. 2022-03-09 14:52:01 +01:00
336685e63b
Add simple readme. 2022-03-09 14:23:20 +01:00
5 changed files with 126 additions and 18 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
ci/
README.md

View file

@ -1,6 +1,7 @@
FROM moby/buildkit FROM moby/buildkit
COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY entrypoint.sh /usr/local/bin/build
ENTRYPOINT [ "entrypoint.sh" ] ENTRYPOINT [ "entrypoint.sh" ]

14
README.md Normal file
View file

@ -0,0 +1,14 @@
# concourse-buildkit
A docker image to build multiarch images on [concourse](https://concourse-ci.org).
## parameters
- dest: Required. The output path for the oci image.
- platform: Optional. A comma seperated list of target platforms, default: current platform
- context: The context with which to build.
- manual: Optional. Don't use params and instead supply all arguments via the command line, default: `false`
## Example
To view a simple invocation just look at [pipeline.yml](ci/pipeline.yml).

68
ci/pipeline.yml Normal file
View file

@ -0,0 +1,68 @@
---
resources:
- name: source
type: git
source:
uri: https://gitea.redxef.at/redxef/concourse-buildkit
branch: master
fetch_tags: true
- name: upstream-image
type: registry-image
check_every: 6h
source:
repository: moby/buildkit
jobs:
- name: build-push
plan:
- get: source
trigger: true
- get: upstream-image
trigger: true
- task: compute-docker-tags
config:
platform: linux
image_resource:
type: registry-image
source:
repository: alpine/git
inputs:
- name: source
path: .
outputs:
- name: docker-tags
run:
path: sh
args:
- -c
- |
#!/usr/bin/env sh
git rev-parse --short HEAD > docker-tags/tags.txt
git show-ref --tags | \
sed -n "/$(git rev-parse HEAD)/ s|$(git rev-parse HEAD).refs/tags/||gp" \
>> docker-tags/tags.txt
- task: build
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
repository: redxef/concourse-buildkit
tag: v0.2.1
inputs:
- name: source
path: .
- name: docker-tags
params:
username: ((docker.username))
password: ((docker.password))
repository: docker.io/redxef/concourse-buildkit
tag: latest
additional_tags: docker-tags/tags.txt
push: true
platform: aarch64,arm,ppc64le,s390x,x86_64
context: .
manual: false
run:
path: build

View file

@ -1,24 +1,47 @@
#!/usr/bin/env sh #!/usr/bin/env sh
DOCKER_LOGIN_FILE_TMPL='{ fail() {
"auths": { echo "Error:" "$@" 1>&2
"{{REGISTRY_URL}}": { exit 1
"auth": "{{BASE64_UNAME_PW}}"
}
}
}'
docker_login() {
# TODO: detect registry url
mkdir -p "$HOME/.docker"
echo "$DOCKER_LOGIN_FILE_TMPL" | \
sed -e "s|{{BASE64_UNAME_PW}}|$(printf '%s:%s' "$username" "$password" | base64)|g" \
-e "s|{{REGISTRY_URL}}|https://index.docker.io/v1/|g" \
> "$HOME/.docker/config.json"
} }
if [ -n "$username" ]; then echo_and_run() {
docker_login echo "$@"
"$@"
}
plain() {
buildctl-daemonless.sh "$@"
}
build() {
if [ -z "$dest" ]; then
fail "missing argument: dest"
fi
if [ -z "$context" ]; then
context=.
fi
if [ -z "$platform" ]; then
platform=""
else
platform="--opt platform=$platform"
fi
echo_and_run buildctl-daemonless.sh \
build \
--frontend dockerfile.v0 \
--local context="$context" \
--local dockerfile="$context" \
$platform \
--output type=oci,dest="$dest"
}
if [ -z "$manual" ]; then
manual=false
fi fi
buildctl-daemonless.sh "$@" if "$manual"; then
plain "$@"
else
build
fi