Skip to content

Update docker-image.yml #4

Update docker-image.yml

Update docker-image.yml #4

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REPO_USERNAME: ${{ github.repository.owner }}
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/$REPO_USERNAME/$IMAGE_NAME:$GITHUB_SHA --tag ghcr.io/$REPO_USERNAME/$IMAGE_NAME:latest
- name: Push to Github Repo
run: |
docker push ghcr.io/$REPO_USERNAME/$IMAGE_NAME:$GITHUB_SHA
docker push ghcr.io/$REPO_USERNAME/$IMAGE_NAME:latest
- name: Logout
run: docker logout