Generic Dockerfile for the new alpine repos #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Images | |
on: | |
push: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 0 * * *' # runs every day at midnight | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
alpine_version: | |
- 2.7 | |
- 3.1 | |
- 3.2 | |
- 3.3 | |
- 3.4 | |
- 3.5 | |
- 3.6 | |
- 3.7 | |
- 3.8 | |
- 3.9 | |
- 3.10 | |
- 3.11 | |
- 3.12 | |
- 3.13 | |
- 3.14 | |
- 3.15 | |
- 3.16 | |
- 3.17 | |
- 3.18 | |
- 3.19 | |
- latest | |
- edge | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push Image | |
run: | | |
if [ -f "Dockerfile-${{ matrix.alpine_version }}" ]; then | |
DOCKERFILE=Dockerfile-${{ matrix.alpine_version }} | |
else | |
DOCKERFILE=Dockerfile | |
fi | |
docker buildx build \ | |
--push \ | |
--pull \ | |
--quiet \ | |
--platform linux/amd64,linux/arm64 \ | |
--tag andrius/alpine-ruby:${{ matrix.alpine_version }} \ | |
--build-arg ALPINE_VERSION=${{ matrix.alpine_version }} \ | |
--file $DOCKERFILE | |
. |