Skip to content

Commit

Permalink
support arm64(armv8)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmj2002 authored May 22, 2024
1 parent 48864c0 commit c15ee1b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ vars.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
Expand All @@ -40,29 +46,22 @@ jobs:
exit 1
fi
- name: Build Docker image
id: build-image
run: |
docker build \
--build-arg GOST_VERSION=${{ steps.get-gost-version.outputs.GOST_VERSION }} \
--tag ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:latest \
--file Dockerfile \
.
- name: Get WARP client version
id: get-warp-client-version
run: |
echo "WARP_VERSION=$(docker run --rm --entrypoint='' caomingjun/warp:latest warp-cli --version | cut -d ' ' -f 2)" >> "$GITHUB_OUTPUT"
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update
echo "WARP_VERSION=$(apt-cache show cloudflare-warp | grep '^Version:' | awk '{print $2}' | sed 's/-[0-9]*$//')" >> "$GITHUB_OUTPUT"
- name: Tag Docker image
id: tag-image
run: |
docker tag \
${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:latest \
- name: Build and push
uses: docker/build-push-action@v5
with:
build-args: |
GOST_VERSION=${{ steps.get-gost-version.outputs.GOST_VERSION }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:latest
${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:${{ steps.get-warp-client-version.outputs.WARP_VERSION }}-${{ steps.get-gost-version.outputs.GOST_VERSION }}
- name: Push Docker image
id: push-image
run: |
docker push ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:latest
docker push ${{ vars.REGISTRY }}/${{ vars.IMAGE_NAME }}:${{ steps.get-warp-client-version.outputs.WARP_VERSION }}-${{ steps.get-gost-version.outputs.GOST_VERSION }}
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
FROM ubuntu:22.04

ARG GOST_VERSION
ARG TARGETPLATFORM

COPY entrypoint.sh /entrypoint.sh

# install dependencies
RUN apt-get update && \
RUN case ${TARGETPLATFORM} in \
"linux/amd64") export ARCH="amd64" ;; \
"linux/arm64") export ARCH="armv8" ;; \
*) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" && exit 1 ;; \
esac && \
echo "Building for ${ARCH} with GOST ${GOST_VERSION}" &&\
apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl gnupg lsb-release sudo && \
curl https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list && \
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list && \
apt-get update && \
apt-get install -y cloudflare-warp && \
apt-get clean && \
apt-get autoremove -y && \
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/gost-linux-amd64-${GOST_VERSION}.gz && \
gunzip gost-linux-amd64-${GOST_VERSION}.gz && \
mv gost-linux-amd64-${GOST_VERSION} /usr/bin/gost && \
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/gost-linux-${ARCH}-${GOST_VERSION}.gz && \
gunzip gost-linux-${ARCH}-${GOST_VERSION}.gz && \
mv gost-linux-${ARCH}-${GOST_VERSION} /usr/bin/gost && \
chmod +x /usr/bin/gost && \
chmod +x /entrypoint.sh && \
useradd -m -s /bin/bash warp && \
Expand Down

0 comments on commit c15ee1b

Please sign in to comment.