-
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.
- Loading branch information
Showing
2 changed files
with
105 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,86 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [prereleased] | ||
push: | ||
branches: | ||
- main | ||
- v* | ||
- dev* | ||
paths: | ||
- "Containerfile" | ||
- ".github/workflows/release.yml" | ||
|
||
jobs: | ||
build-ghcr: | ||
name: Build And Push to ghcr.io | ||
runs-on: ubuntu-latest | ||
env: | ||
REGISTRY_USER: ${{ github.actor }} | ||
REGISTRY_PASSWORD: ${{ github.token }} | ||
IMAGE_REGISTRY: ghcr.io | ||
ORG_NAME: idevsig | ||
IMAGE: cfspeedtest | ||
TAG: latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to ghcr.io | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ env.REGISTRY_USER }} | ||
password: ${{ env.REGISTRY_PASSWORD }} | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Containerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ env.ORG_NAME }}/${{ env.IMAGE }}:${{ env.TAG }} | ||
|
||
build-docker: | ||
name: Build And Push Docker Hub | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
IMAGE: cfspeedtest | ||
TAG: latest | ||
|
||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ env.DOCKERHUB_USERNAME }} | ||
password: ${{ env.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Containerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE }}:${{ env.TAG }} |
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,19 @@ | ||
FROM golang:alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
RUN apk add git curl | ||
|
||
RUN git clone https://github.com/XIU2/CloudflareSpeedTest.git; \ | ||
cd CloudflareSpeedTest; \ | ||
go build | ||
|
||
FROM alpine:latest | ||
LABEL maintainer="Jetsung Chan<[email protected]>" | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /app/CloudflareSpeedTest/CloudflareSpeedTest /usr/local/bin/CloudflareSpeedTest | ||
COPY --from=builder /app/CloudflareSpeedTest/ip.txt /app/ip.txt | ||
|
||
CMD [ "CloudflareSpeedTest" ] |