Skip to content

Commit

Permalink
GitHub Action for Automatic Docker Registry Push (#53)
Browse files Browse the repository at this point in the history
# Background
Locally pushing image every time you make a release is tedious.

## Checklist Before PR Review
- [x] The following has been handled:
  -  `Draft` is set for this PR
  - `Title` is checked
  - `Background` is filled
  - `Assignee` is set
  - `Labels` are set
  - `development` is linked if related issue exists

## Checklist (Right Before PR Review Request)
- [x] The following has been handled:
  - `yarn inspect` is run
  - `TODOs` are handled and checked
  - Final Operation Check is done
  - Make this PR as an open PR

## Checklist (Reviewers)
- [x] Check if there are any other missing TODOs that are not yet listed
- [x] Review Code
- [x] Every item on the checklist has been addressed accordingly
- [x] If `development` is associated to this PR, you must check if every
TODOs are handled
  • Loading branch information
mlajkim committed Jul 4, 2024
1 parent 6832715 commit 418b0a9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ajktown
password: ${{ secrets.AJKTOWN_ORG_ACTION }}

- name: Build the Docker image for PR
if: github.event_name == 'pull_request'
run: docker build . --file Dockerfile --tag ajktown/consistency:pr${{ github.event.pull_request.number }}

- name: Push the Docker image for PR
if: github.event_name == 'pull_request'
run: docker push ajktown/consistency:pr${{ github.event.pull_request.number }}

- name: Build the Docker image as latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: docker build . --file Dockerfile --tag ajktown/consistency:latest

- name: Push the Docker image as latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: docker push ajktown/consistency:latest
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Master Your Daily Tasks with GitHub Commit Calendar-Style Tracking
- [Overview](#overview)
- [For Developers](#for-developers)
- [Public Image](#public-image)
- [Push image command](#push-image-command)
- [Push image command locally](#push-image-command-locally)
- [About the starter of this project](#about-the-starter-of-this-project)
- [Getting Started](#getting-started)
- [Learn More](#learn-more)
Expand All @@ -34,8 +34,8 @@ ConsistencyGPT revolutionizes daily task management by integrating the familiar
https://hub.docker.com/r/ajktown/consistency/tags


### Push image command
You must have permission to push to the repository.
### Push image command locally
By default, the GitHub Action will build and push the image to the Docker Hub. If you want to push the image locally, you can use the following commands:
```sh

docker build -t ajktown/consistency:latest .
Expand Down

0 comments on commit 418b0a9

Please sign in to comment.