Skip to content

Docker Image CI

Docker Image CI #35

Workflow file for this run

name: Docker Image CI
on:
workflow_dispatch:
inputs:
IMAGE_NAME:
type: choice
description: 'Select the docker image to build and push'
required: true
options:
- centos-7-python3
- centos-7
- centos-7-cross-arm64
default: 'centos-7'
# push:
# branches: [ "master" ]
# pull_request:
# branches: [ "master" ]
env:
DOCKER_FILE: ${{ fromJSON('{"centos-7-python3":"Dockerfile-7-python3","centos-7":"Dockerfile-7","centos-7-cross-arm64":"Dockerfile-7-cross-arm64"}')[github.event.inputs.IMAGE_NAME] }}
DOCKER_IMAGE: "${{ github.event.inputs.IMAGE_NAME }}"
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
# run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push ${{ github.event.inputs.IMAGE_NAME }}
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ env.DOCKER_FILE }}
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/centos-ci-gcc:${{ github.event.inputs.IMAGE_NAME }}
# -
# name: Build and push Dockerfile-7-python3
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Dockerfile-7-python3
# push: true
# tags: ${{ secrets.DOCKER_USERNAME }}/centos-ci-gcc:centos-7-python3
# -
# name: Build and push Dockerfile-7
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./Dockerfile-7
# push: true
# tags: ${{ secrets.DOCKER_USERNAME }}/centos-ci-gcc:centos-7