first commit
This commit is contained in:
commit
46b20aa03d
4 changed files with 52 additions and 0 deletions
3
Dockerfile
Normal file
3
Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FROM docker.io/moby/buildkit:master-rootless
|
||||||
|
COPY entrypoint.sh /usr/local/bin/
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
1
README.md
Normal file
1
README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# buildah@v1
|
20
action.yaml
Normal file
20
action.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
inputs:
|
||||||
|
dockerfile:
|
||||||
|
description: Dockerfile path
|
||||||
|
default: ./Dockerfile
|
||||||
|
image:
|
||||||
|
description: Image name and tag
|
||||||
|
default: ${{ forgejo.repository }}:${{ forgejo.ref_name }}
|
||||||
|
username:
|
||||||
|
description: Registry username
|
||||||
|
default: ${{ forgejo.repository_owner }}
|
||||||
|
password:
|
||||||
|
description: Registry password
|
||||||
|
required: true
|
||||||
|
cache:
|
||||||
|
description: Use registry cache
|
||||||
|
default: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: docker
|
||||||
|
image: Dockerfile
|
28
entrypoint.sh
Executable file
28
entrypoint.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/sh -ex
|
||||||
|
|
||||||
|
#shellcheck disable=SC1091
|
||||||
|
[ -f .env ] && . ./.env
|
||||||
|
|
||||||
|
if [ -z "$IMAGEAPP" ]; then
|
||||||
|
REGISTRY="$(echo "$GITHUB_SERVER_URL" | sed 's .*:// ')"
|
||||||
|
IMAGEAPP="$REGISTRY/$INPUT_IMAGE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$INPUT_CACHE" = true ]; then
|
||||||
|
set -- --import-cache "type=registry,ref=$IMAGEAPP/cache" \
|
||||||
|
--export-cache "type=registry,ref=$IMAGEAPP/cache"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF > "$DOCKER_CONFIG/config.json"
|
||||||
|
{
|
||||||
|
"auths": {
|
||||||
|
"$GITHUB_SERVER_URL": {
|
||||||
|
"username": "$INPUT_USERNAME",
|
||||||
|
"password": "$INPUT_PASSWORD"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
buildctl build "$@" -o "type=image,name=$IMAGEAPP,push=true" \
|
||||||
|
--local context="$(dirname "$INPUT_DOCKERFILE")" \
|
||||||
|
--local dockerfile="$INPUT_DOCKERFILE"
|
Loading…
Add table
Add a link
Reference in a new issue