From 71d41f0a703d793f00743c7f6fbdbe11fcfbe9cb Mon Sep 17 00:00:00 2001 From: "sijie.sun" Date: Sun, 4 Aug 2024 00:24:51 +0800 Subject: [PATCH] introduce docker image updater --- .github/workflows/Dockerfile | 35 +++++++++++++++++++++ .github/workflows/docker.yml | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .github/workflows/Dockerfile create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 0000000..71caa53 --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,35 @@ +FROM alpine:latest AS builder + +ARG TARGETPLATFORM + +COPY . /tmp/artifacts +RUN mkdir -p /tmp/output; \ + cd /tmp/artifacts; \ + ARTIFACT_ARCH=""; \ + if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + ARTIFACT_ARCH="x86_64"; \ + elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ + ARTIFACT_ARCH="aarch64"; \ + else \ + echo "Unsupported architecture: $TARGETARCH"; \ + exit 1; \ + fi; \ + cp /tmp/artifacts/easytier-linux-${ARTIFACT_ARCH}/* /tmp/output; + +FROM alpine:latest + +WORKDIR /app +COPY --from=builder --chmod=755 /tmp/output/* /usr/local/bin + +# tcp +EXPOSE 11010/tcp +# udp +EXPOSE 11010/udp +# wg +EXPOSE 11011/udp +# ws +EXPOSE 11011/tcp +# wss +EXPOSE 11012/tcp + +ENTRYPOINT ["easytier-core"] diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..50af2ca --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,60 @@ +name: EasyTier Docker + +on: + workflow_dispatch: + inputs: + run_id: + description: 'The run id of EasyTier-Core Action in EasyTier repo' + type: number + default: 10228239965 + required: true + image_tag: + description: 'Tag for this image build' + type: string + default: 'v1.2.0' + required: true + mark_latest: + description: 'Mark this image as latest' + type: boolean + default: false + required: true + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Download artifact + id: download-artifact + uses: dawidd6/action-download-artifact@v6 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + run_id: ${{ inputs.run_id }} + repo: EasyTier/EasyTier + path: docker_context + - name: List files + run: | + ls -l -R . + - + name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./docker_context + platforms: linux/amd64,linux/arm64 + push: true + file: .github/workflows/Dockerfile + tags: easytier/easytier:${{ inputs.image_tag }}${{ inputs.mark_latest && ',easytier/easytier:latest' || '' }},