Maybe got it. #6
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: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
IMAGE_NAME: fastapi-data-collector | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to Github Repo | |
run: docker login -u $REPO_USERNAME -p ${{ secrets.GITHUB_TOKEN }} ghcr.io | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag ghcr.io/$GITHUB_REPOSITORY_OWNER/$IMAGE_NAME:$GITHUB_SHA --tag ghcr.io/$GITHUB_REPOSITORY_OWNER/$IMAGE_NAME:latest | |
- name: Push to Github Repo | |
run: | | |
docker push ghcr.io/$GITHUB_REPOSITORY_OWNER/$IMAGE_NAME:$GITHUB_SHA | |
docker push ghcr.io/$GITHUB_REPOSITORY_OWNER/$IMAGE_NAME:latest | |
- name: Logout | |
run: docker logout | |