feat: cache
This commit is contained in:
parent
2c7bab8c91
commit
e06631721b
@ -1,3 +0,0 @@
|
||||
FROM gcr.io/kaniko-project/executor:debug
|
||||
COPY build.sh /usr/local/bin/
|
||||
ENTRYPOINT ["build.sh"]
|
20
action.yaml
20
action.yaml
@ -16,12 +16,14 @@ inputs:
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ACTION_DOCKERFILE=${{ inputs.dockerfile }}
|
||||
- ACTION_TAG=${{ inputs.tag }}
|
||||
- ACTION_REGISTRY=${{ gitea.server_url }}
|
||||
- ACTION_IMAGE=${{ gitea.repository }}
|
||||
- ACTION_USERNAME=${{ inputs.username }}
|
||||
- ACTION_PASSWORD=${{ inputs.password }}
|
||||
using: composite
|
||||
steps:
|
||||
- name: Build
|
||||
run: ${{ gitea.action_path }}/build.sh
|
||||
env:
|
||||
- ACTION_DOCKERFILE=${{ inputs.dockerfile }}
|
||||
- ACTION_TAG=${{ inputs.tag }}
|
||||
- ACTION_REGISTRY=${{ gitea.server_url }}
|
||||
- ACTION_IMAGE=${{ gitea.repository }}
|
||||
- ACTION_USERNAME=${{ inputs.username }}
|
||||
- ACTION_PASSWORD=${{ inputs.password }}
|
||||
|
22
build.sh
Executable file → Normal file
22
build.sh
Executable file → Normal file
@ -1,9 +1,8 @@
|
||||
#!/bin/sh -ex
|
||||
#!/bin/bash -e
|
||||
|
||||
# source environment from args
|
||||
eval "$*"
|
||||
exec 3<> /dev/tty
|
||||
|
||||
cat <<EOF > /kaniko/.docker/config.json
|
||||
cat <<EOF >&3
|
||||
{
|
||||
"auths": {
|
||||
"$ACTION_REGISTRY": {
|
||||
@ -14,8 +13,13 @@ cat <<EOF > /kaniko/.docker/config.json
|
||||
}
|
||||
EOF
|
||||
|
||||
REGISTRY="$(echo "$ACTION_REGISTRY" | sed 's .*:// ')"
|
||||
/kaniko/executor \
|
||||
--context "${ACTION_DOCKERFILE%/*}" \
|
||||
--dockerfile "$ACTION_DOCKERFILE" \
|
||||
--destination "$REGISTRY/$ACTION_IMAGE:$ACTION_TAG"
|
||||
REGISTRY="${ACTION_REGISTRY/https:\/\/}"
|
||||
docker run --rm \
|
||||
-v "$PWD:$PWD:ro" \
|
||||
-v "$HOME/.cache/kaniko:/cache" \
|
||||
-v "/proc/$$/fd/3:/kaniko/.docker/config.json:ro" \
|
||||
gcr.io/kaniko-project/executor:latest \
|
||||
--cache true \
|
||||
--context "${ACTION_DOCKERFILE%/*}" \
|
||||
--dockerfile "$ACTION_DOCKERFILE" \
|
||||
--destination "$REGISTRY/$ACTION_IMAGE:$ACTION_TAG"
|
||||
|
Loading…
Reference in New Issue
Block a user