Compare commits

..

No commits in common. "master" and "248cb76ac6f4d4caec0d57fc7cfaefdffabe98b5" have entirely different histories.

5 changed files with 18 additions and 126 deletions

View file

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

View file

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

View file

@ -1,14 +0,0 @@
# 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).

View file

@ -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

View file

@ -1,47 +1,24 @@
#!/usr/bin/env sh
fail() {
echo "Error:" "$@" 1>&2
exit 1
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"
}
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
if [ -n "$username" ]; then
docker_login
fi
if "$manual"; then
plain "$@"
else
build
fi
buildctl-daemonless.sh "$@"