Publish Docker image #12
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: Publish Docker image | |
| on: | |
| schedule: | |
| - cron: "0 12 * * 1" | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| push_to_registry: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: get_image_name | |
| run: | | |
| repository=${{ github.repository }} | |
| IMAGE_NAME=${{ github.actor }}/${repository##*/} | |
| echo IMAGE_NAME=$IMAGE_NAME | |
| echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV | |
| - name: Check out the repo | |
| uses: actions/checkout@v2 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push to Docker Hub | |
| run: | | |
| docker build -f Dockerfile -t ${{ env.IMAGE_NAME }}:2.4-alpine . | |
| docker push ${{ env.IMAGE_NAME }}:2.4-alpine |