Skip to content

Create build-and-push.yml #1

Create build-and-push.yml

Create build-and-push.yml #1

name: Build and Push Images
on:
push:
branches: [ "main" ]
#schedule:
#- cron: '0 15 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Github Action'
uses: actions/checkout@v3
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: 'Build and Push Docker Images'
run: |
build_date=$(date +%s)
images=(
base-silverblue
framework-silverblue
dev-distrobox
)
for image in ${images[@]}
do
docker build . --file Containerfile --target $image --tag ghcr.io/andyrusiecki/${image}:${build_date}
docker tag ghcr.io/andyrusiecki/${image}:${build_date} ghcr.io/andyrusiecki/${image}:latest
docker push --all-tags ghcr.io/andyrusiecki/${image}
done