Compare commits
24 commits
248cb76ac6
...
master
Author | SHA1 | Date | |
---|---|---|---|
9c9cd28de9 | |||
f7d3e95ef0 | |||
03513ee320 | |||
6d22bb3c51 | |||
9bc8d05101 | |||
92f27c55a5 | |||
37fabc96ee | |||
3641832ce8 | |||
7103d4760d | |||
9fd0228d87 | |||
37efbb26ab | |||
9c2c8b9b09 | |||
5ca19483fa | |||
4a5bfd6027 | |||
18896f8e40 | |||
3da633753e | |||
306ebb6e49 | |||
36f0e3414f | |||
57b283703e | |||
539064d050 | |||
7cb4bda424 | |||
572e0d27bc | |||
2b7cbe1f94 | |||
336685e63b |
5 changed files with 130 additions and 18 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
ci/
|
||||
README.md
|
|
@ -1,6 +1,7 @@
|
|||
FROM moby/buildkit
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
COPY entrypoint.sh /usr/local/bin/build
|
||||
ENTRYPOINT [ "entrypoint.sh" ]
|
||||
|
||||
|
||||
|
|
18
README.md
Normal file
18
README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# concourse-buildkit
|
||||
|
||||
**DEPRECATED: this resource is no longer needed, the concourse build
|
||||
task in combination with the registry-image can build and push multiarch
|
||||
images now.**
|
||||
|
||||
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
68
ci/pipeline.yml
Normal 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
|
|
@ -1,24 +1,47 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
DOCKER_LOGIN_FILE_TMPL='{
|
||||
"auths": {
|
||||
"{{REGISTRY_URL}}": {
|
||||
"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"
|
||||
fail() {
|
||||
echo "Error:" "$@" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -n "$username" ]; then
|
||||
docker_login
|
||||
echo_and_run() {
|
||||
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
|
||||
|
||||
buildctl-daemonless.sh "$@"
|
||||
if "$manual"; then
|
||||
plain "$@"
|
||||
else
|
||||
build
|
||||
fi
|
||||
|
|
Reference in a new issue