Compare commits
No commits in common. "master" and "248cb76ac6f4d4caec0d57fc7cfaefdffabe98b5" have entirely different histories.
master
...
248cb76ac6
5 changed files with 18 additions and 130 deletions
|
@ -1,2 +0,0 @@
|
||||||
ci/
|
|
||||||
README.md
|
|
|
@ -1,7 +1,6 @@
|
||||||
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" ]
|
||||||
|
|
||||||
|
|
||||||
|
|
18
README.md
18
README.md
|
@ -1,18 +0,0 @@
|
||||||
# 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).
|
|
|
@ -1,68 +0,0 @@
|
||||||
---
|
|
||||||
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,47 +1,24 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
fail() {
|
DOCKER_LOGIN_FILE_TMPL='{
|
||||||
echo "Error:" "$@" 1>&2
|
"auths": {
|
||||||
exit 1
|
"{{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"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_and_run() {
|
if [ -n "$username" ]; then
|
||||||
echo "$@"
|
docker_login
|
||||||
"$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
if "$manual"; then
|
buildctl-daemonless.sh "$@"
|
||||||
plain "$@"
|
|
||||||
else
|
|
||||||
build
|
|
||||||
fi
|
|
||||||
|
|
Reference in a new issue