-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: build docker image and publish to docker hub
- Loading branch information
1 parent
aa754d8
commit d281d17
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build Docker Image | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
push_to_registery: | ||
name: Push Docker Image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Extract metadata (tags and labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: shinthant101/gograte | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM golang:bullseye | ||
|
||
WORKDIR /app | ||
|
||
RUN go install github.com/Shin-Thant/gograte/cmd/gograte@latest | ||
|
||
# 1. /bin/bash - start the interactive shell | ||
# 2. -c - pass the following command to the shell | ||
# 3. cd /app - change the working directory to /app | ||
# 4. /bin/bash - start the interactive shell in the new working directory | ||
CMD ["/bin/bash", "-c", "cd /app && /bin/bash"] | ||
|
||
# docker run --name gograte_db -e POSTGRES_PASSWORD=pwd -e POSTGRES_USER=postgres -p 5000:5432 postgres:bullseye |