Skip to content

Commit

Permalink
revert previous modifications, added dockerhub login and push
Browse files Browse the repository at this point in the history
  • Loading branch information
Semior001 committed Mar 11, 2024
1 parent baf482a commit a803d5f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
46 changes: 30 additions & 16 deletions .github/workflows/.go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,36 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and deploy master image to ghcr
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v5
- name: login to dockerhub
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@v3
with:
context: ${{ github.workspace }}
file: ${{ github.workspace }}/Dockerfile
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: ghcr.io/semior001/groxy:master,ghcr.io/semior001/groxy:${{ github.sha }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: build and deploy master image to ghcr.io
if: ${{ github.ref == 'refs/heads/master' }}
env:
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
docker buildx build --push \
--build-arg CI=github --build-arg GITHUB_SHA=${GITHUB_SHA} --build-arg GIT_BRANCH=${ref} \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/semior001/groxy:${ref} -t semior/groxy:${ref} .
- name: build and deploy tagged (latest) image to ghcr
- name: build and deploy tagged (latest) image to ghcr.io
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: ${{ github.workspace }}/Dockerfile
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: ghcr.io/semior001/groxy:latest,ghcr.io/semior001/groxy:${{ github.ref }}
env:
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
docker buildx build --push \
--build-arg CI=github --build-arg GITHUB_SHA=${GITHUB_SHA} --build-arg GIT_BRANCH=${ref} \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/semior001/groxy:${ref} -t ghcr.io/semior001/groxy:latest .
-t semior/groxy:${ref} -t semior/groxy:latest .
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ You can install gRoxy using the following command:
go install github.com/Semior001/groxy/cmd/groxy@latest
```

Or you can pull the docker image:
Or you can pull the docker image from ghcr.io:

```shell
docker pull ghcr.io/semior001/groxy:latest
```

Or from the docker hub:

```shell
docker pull semior/groxy:latest
```

## usage

```
Expand Down

0 comments on commit a803d5f

Please sign in to comment.