bunkerized-nginx/.github/workflows/push-docker.yml
dependabot[bot] 6738b95524
deps/gha: bump actions/checkout from 4.1.0 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8ade135a41...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-18 04:15:57 +00:00

83 lines
2.6 KiB
YAML

name: Push image (REUSABLE)
on:
workflow_call:
inputs:
IMAGE:
required: true
type: string
TAGS:
required: true
type: string
CACHE_FROM:
required: true
type: string
DOCKERFILE:
required: true
type: string
secrets:
DOCKER_USERNAME:
required: true
DOCKER_TOKEN:
required: true
ARM_SSH_KEY:
required: true
ARM_SSH_CONFIG:
required: true
ARM_SSH_IP:
required: true
jobs:
push:
runs-on: ubuntu-latest
steps:
# Prepare
- name: Check out repository code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Login to Docker Hub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to ghcr
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup SSH for ARM node
run: |
mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_rsa_arm
chmod 600 ~/.ssh/id_rsa_arm
echo "$SSH_CONFIG" | sed "s/SSH_IP/$SSH_IP/g" > ~/.ssh/config
env:
SSH_KEY: ${{ secrets.ARM_SSH_KEY }}
SSH_IP: ${{ secrets.ARM_SSH_IP }}
SSH_CONFIG: ${{ secrets.ARM_SSH_CONFIG }}
- name: Setup Buildx (ARM)
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
with:
endpoint: ssh://root@arm
platforms: linux/arm64,linux/arm/v7,linux/arm/v6
# Compute metadata
- name: Extract metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: bunkerity/${{ inputs.IMAGE }}
# Build and push
- name: Build and push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
file: ${{ inputs.DOCKERFILE }}
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7
push: true
tags: ${{ inputs.TAGS }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha,scope=${{ inputs.CACHE_FROM }}-amd64
type=gha,scope=${{ inputs.CACHE_FROM }}-386
type=gha,scope=${{ inputs.CACHE_FROM }}-arm