Some checks failed
Build and Push / Build and Push Docker Image (push) Failing after 3s
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
name: Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build and Push Docker Image
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Generate image tag
|
|
id: tag
|
|
run: |
|
|
TIMESTAMP=$(date +%s)
|
|
SHORT_SHA=$(git rev-parse --short=7 HEAD | cut -c1-7)
|
|
TAG="main-${TIMESTAMP}-${SHORT_SHA}"
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and Push with Kaniko
|
|
run: |
|
|
KANIKO_VERSION="v1.23.2"
|
|
curl -fsSL "https://github.com/GoogleContainerTools/kaniko/releases/download/${KANIKO_VERSION}/executor-linux-amd64" \
|
|
-o /usr/local/bin/executor
|
|
chmod +x /usr/local/bin/executor
|
|
|
|
mkdir -p /kaniko/.docker
|
|
cat > /kaniko/.docker/config.json <<EOF
|
|
{"auths":{"git.mcintire.me":{"username":"graham","password":"${{ secrets.FORGEJO_TOKEN }}"}}}
|
|
EOF
|
|
|
|
/usr/local/bin/executor \
|
|
--context=dir://. \
|
|
--dockerfile=Dockerfile \
|
|
--destination="git.mcintire.me/graham/aprs.me:${{ steps.tag.outputs.tag }}" \
|
|
--destination="git.mcintire.me/graham/aprs.me:latest" \
|
|
--cache=true
|