Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github CI workflow to build and push image to the Docker hub #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Docker image

on:
push:
branches:
- main
release:
types: [ published ]

env:
IMAGE_NAME: hmnd-tellr

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}, ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ docker compose build
docker compose up
```

# GitHub CI Workflow

This project uses GitHub CI workflow for automatic Docker image building and pushing to Docker Hub. The workflow is triggered on every push to the main branch and on every new published release.

To use this workflow, you need to have your Docker Hub username and token stored in your GitHub repository secrets. These secrets should be named DOCKERHUB_USERNAME and DOCKERHUB_TOKEN respectively.

To set these secrets, go to the "Settings" tab of your repository, select "Secrets" from the left sidebar, and click on "New repository secret".

Once these secrets are set, every time you push to the main branch, GitHub Actions will build a new Docker image and push it to your Docker Hub repository.

## Usage

Access the status report by URL. Use `AUTH` as set in `.env` within the URL.
Expand Down