Skip to content

Commit

Permalink
Merge pull request #22 from gkeesh7/repository_upkeep
Browse files Browse the repository at this point in the history
Repository upkeep Adding github actions to push images to ghcr and updating instructions for running on minikube for windows.
  • Loading branch information
gkeesh7 authored Aug 11, 2024
2 parents 42908d1 + 5b011cc commit a7ae6fd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish-package-ghcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Docker Image CI

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

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: |
docker login --username gkeesh7 --password ${{ secrets.GH_PAT }} ghcr.io
docker build . --file Dockerfile --tag ghcr.io/gkeesh7/url-shortner:latest
docker push ghcr.io/gkeesh7/url-shortner:latest
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM golang:1.16-alpine
FROM golang:1.17-alpine

RUN apk update
RUN apk add git
Expand All @@ -10,7 +10,7 @@ ENV PKG_PATH=$GOPATH/src/$PKG_NAME
WORKDIR $PKG_PATH

COPY . $PKG_PATH
RUN go env -w GO111MODULE=off
RUN go mod download
RUN go build main.go

WORKDIR $PKG_PATH
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ kubectl port-forward deployment/url-shortner-deployment 8080:8080
```
The guide to make sure that the docker image gets built and pulled locally is [here](https://stackoverflow.com/questions/42564058/how-to-use-local-docker-images-with-minikube)
For windows machines incase ```eval $(minikube docker-env)``` might not work so save the image to a tar file and put into minikube
```
docker image save -o image.tar my_image:tag
minikube image load image.tar
```
#### Unit Testing and Perf Testing
For unit testing you can run the go test command and get the test coverage for the project
Expand Down

0 comments on commit a7ae6fd

Please sign in to comment.