Docker Image CI #40
This file contains hidden or 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: Docker Image CI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dockerfile_path: | |
| description: Dockerfile path | |
| required: true | |
| default: php/8.2-laravel.Dockerfile | |
| image: | |
| description: Image name | |
| required: true | |
| default: haidarns/php:8.2-laravel-nginx | |
| build_args: | |
| description: Additional docker build args | |
| default: --rm --no-cache | |
| build_env: | |
| description: Docker build environment | |
| default: DOCKER_BUILDKIT=1 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Build the Docker image | |
| run: ${{ github.event.inputs.build_env }} docker build --file ${{ github.event.inputs.dockerfile_path }} --tag ${{ github.event.inputs.image }} ${{ github.event.inputs.build_args }} . | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Push docker image | |
| run: docker push ${{ github.event.inputs.image }} | |