Skip to content

Commit

Permalink
update deploy ga
Browse files Browse the repository at this point in the history
  • Loading branch information
Fajar-Islami committed Oct 16, 2024
1 parent 0a9e223 commit 07f2196
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ jobs:
echo "tagimg ${{ needs.build-image.outputs.tagimg }} " >> test.md
docker login ${{env.REGISTRY}} -u ${{github.actor}} -p ${{secrets.GITHUB_TOKEN}}
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
echo ${{ vars.ENV }} | base64 -d > .env
docker ps -a --filter "ancestor=${{ env.IMAGE_NAME }}" --format "{{.ID}}" | xargs docker rm
docker run --add-host=host.docker.internal:host-gateway --name ${{ env.IMAGE_NAME }}_${{ github.sha }} -v ./.env:/app/.env -d --restart=on-failure:5 --network fajar_discord_bot ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
rm .env
# docker login ${{env.REGISTRY}} -u ${{github.actor}} -p ${{secrets.GITHUB_TOKEN}}
# docker info
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
FROM golang:1.22.4-alpine as build
LABEL stage=dockerbuilder

WORKDIR /app
# Copy go.mod and go.sum first to take advantage of Docker caching.
COPY go.mod go.sum ./

# Download dependencies.
RUN go mod download

# copy code
COPY . .

# Build the binary
Expand Down
6 changes: 5 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ dockerdown: ## rm compose image

dockerrm:
docker rm ${registry}/${username}/${image}:${tags} -f
docker rmi ${registry}/${username}/${image}:${tags}
docker rmi ${registry}/${username}/${image}:${tags}


docker run -it --rm ghcr.io/fajar-islami/fajar_discord_bot:0a9e223cca4f10655fece8b611979a6ac84846de bash
docker exec -it ghcr.io/fajar-islami/fajar_discord_bot:0a9e223cca4f10655fece8b611979a6ac84846de /bin/bash

0 comments on commit 07f2196

Please sign in to comment.