This commit is contained in:
BecodReyes 2022-04-14 14:54:26 +00:00
parent b0a004e45f
commit 7f1fe2704d
4 changed files with 46 additions and 38 deletions

View File

@ -1,4 +1,4 @@
name: Build Docker Image name: Build Image and Publish to Dockerhub & GPR
on: on:
release: release:
@ -9,77 +9,76 @@ on:
description: 'Image tag' description: 'Image tag'
required: true required: true
default: 'test' default: 'test'
jobs: jobs:
buildx: image:
name: Build Image from Dockerfile and binaries
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- # environment
name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Get current date with:
id: date fetch-depth: '0'
run: echo "::set-output name=today::$(date +'%Y-%m-%d')"
- - name: Set up QEMU
name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
-
name: Available platforms # get image tag name
run: echo ${{ steps.buildx.outputs.platforms }} - name: Get Image Tag Name
-
name: Get Image Tag Name
run: | run: |
if [ x${{ github.event.inputs.tag }} == x"" ]; then if [ x${{ github.event.inputs.tag }} == x"" ]; then
echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
else else
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
fi fi
- - name: Login to DockerHub
name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }} password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Login to the GPR - name: Login to the GPR
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push frpc # prepare image tags
- name: Prepare Image Tags
run: |
echo "DOCKERFILE_FRPC_PATH=dockerfiles/Dockerfile-for-frpc" >> $GITHUB_ENV
echo "DOCKERFILE_FRPS_PATH=dockerfiles/Dockerfile-for-frps" >> $GITHUB_ENV
echo "TAG_FRPC=fatedier/frpc:${{ env.TAG_NAME }}" >> $GITHUB_ENV
echo "TAG_FRPS=fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV
echo "TAG_FRPC_GPR=ghcr.io/fatedier/frpc:${{ env.TAG_NAME }}" >> $GITHUB_ENV
echo "TAG_FRPS_GPR=ghcr.io/fatedier/frps:${{ env.TAG_NAME }}" >> $GITHUB_ENV
- name: Build and push frpc
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: ./Dockerfile.frpc file: ./dockerfiles/Dockerfile-for-frpc
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
tags: | tags: |
fatedier/frpc:dev ${{ env.TAG_FRPC }}
fatedier/frpc:${{ env.TAG_NAME }} ${{ env.TAG_FRPC_GPR }}
fatedier/frpc:${{ steps.date.outputs.today }}
ghcr.io/fatedier/frpc:dev - name: Build and push frps
ghcr.io/fatedier/frpc:${{ env.TAG_NAME }}
-
name: Build and push frps
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
context: . context: .
file: ./Dockerfile.frps file: ./dockerfiles/Dockerfile-for-frps
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
tags: | tags: |
fatedier/frps:dev ${{ env.TAG_FRPS }}
fatedier/frps:${{ env.TAG_NAME }} ${{ env.TAG_FRPS_GPR }}
fatedier/frps:${{ steps.date.outputs.today }}
ghcr.io/fatedier/frps:dev
ghcr.io/fatedier/frps:${{ env.TAG_NAME }}

9
.gitpod.yml Normal file
View File

@ -0,0 +1,9 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
# and commit this file to your remote git repository to share the goodness with others.
tasks:
- init: go get && go build ./... && go test ./... && make
command: go run