mirror of https://github.com/kha7iq/pingme
Merge pull request #10 from kha7iq/add-docker-support
Add docker support for multi arch imagespull/11/head
commit
81d4fcc89e
@ -1,29 +1,66 @@
|
|||||||
name: goreleaser
|
name: build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
release-pingme:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
-
|
-
|
||||||
name: Set up Go
|
name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.16
|
go-version: '1.16'
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Cache Go modules
|
||||||
uses: goreleaser/goreleaser-action@v2
|
uses: actions/cache@v2.1.5
|
||||||
with:
|
with:
|
||||||
version: latest
|
path: ~/go/pkg/mod
|
||||||
args: release --rm-dist
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
-
|
||||||
|
name: Diff
|
||||||
|
run: git diff
|
||||||
|
-
|
||||||
|
name: Docker Login
|
||||||
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
|
echo "${GITHUB_TOKEN}" | docker login ghcr.io --username $GITHUB_ACTOR --password-stdin
|
||||||
|
-
|
||||||
|
name: GoReleaser
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
||||||
|
./goreleaser
|
||||||
|
elif [[ $GITHUB_REF == refs/heads/master ]]; then
|
||||||
|
./goreleaser --snapshot
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
name: Clear
|
||||||
|
if: always() && startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: |
|
||||||
|
rm -f ${HOME}/.docker/config.json
|
@ -0,0 +1,6 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
COPY scripts/entrypoint.sh /usr/bin/entrypoint.sh
|
||||||
|
RUN chmod +x /usr/bin/entrypoint.sh
|
||||||
|
COPY pingme /usr/bin/pingme
|
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
[ "$PINGME_USE_SERVICE" ]
|
||||||
|
: ${PINGME_USE_SERVICE:=""}
|
||||||
|
|
||||||
|
pingme $PINGME_USE_SERVICE
|
Loading…
Reference in new issue