Merge pull request #7 from XLsoft-Corporation/master #9
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: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build the Docker image | |
| run: docker build . --file Dockerfile --tag ${{ vars.DOCKERHUB_IMAGE_NAME }}:$(date +%Y%m%d) | |
| - name: Push the Docker image | |
| run: docker push ${{ vars.DOCKERHUB_IMAGE_NAME }}:$(date +%Y%m%d) | |
| - name: Push the Docker image with latest tag | |
| run: docker tag ${{ vars.DOCKERHUB_IMAGE_NAME }}:$(date +%Y%m%d) ${{ vars.DOCKERHUB_IMAGE_NAME }}:latest && docker push ${{ vars.DOCKERHUB_IMAGE_NAME }}:latest |