single multiplatform build for shadowsockets-rust
Some checks failed
CI / Build shadowsocks-rust docker images (push) Has been cancelled

This commit is contained in:
2024-06-25 09:04:29 +08:00
parent a4d566fb29
commit 62921644ae
2 changed files with 14 additions and 25 deletions

View File

@@ -22,33 +22,18 @@ jobs:
username: woggioni
password: ${{ secrets.PUBLISHER_TOKEN }}
-
name: Build and push sserver-rust amd64 image
uses: docker/build-push-action@v5.3.0
name: Build and push sserver-rust images
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:shadowsocks-rust"
platforms: linux/amd64
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
"gitea.woggioni.net/woggioni/sserver-rust:latest"
"gitea.woggioni.net/woggioni/sserver-rust:v1.20.1"
build-args: |
"TARGETARCH=amd64"
"VERSION=1.20.1"
cache-from: type=registry,ref=gitea.woggioni.net/woggioni/sserver-rust:buildx
cache-to: type=registry,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true,ref=gitea.woggioni.net/woggioni/sserver-rust:buildx
-
name: Build and push sserver-rust arm64 image
uses: docker/build-push-action@v5.3.0
with:
context: "{{defaultContext}}:shadowsocks-rust"
platforms: linux/arm64
push: true
tags: |
"gitea.woggioni.net/woggioni/sserver-rust:latest"
"gitea.woggioni.net/woggioni/sserver-rust:v1.20.1"
build-args: |
"TARGETARCH=arm64"
"VERSION=1.20.1"
build-args: "VERSION=1.20.1"
cache-from: type=registry,ref=gitea.woggioni.net/woggioni/sserver-rust:buildx
cache-to: type=registry,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true,ref=gitea.woggioni.net/woggioni/sserver-rust:buildx

View File

@@ -1,6 +1,6 @@
FROM --platform=$BUILDPLATFORM rust:alpine3.20 AS builder
FROM --platform=$TARGETPLATFORM rust:alpine AS builder
ARG TARGETARCH VERSION
ARG VERSION TARGETPLATFORM
RUN set -x \
&& apk add --no-cache build-base cmake llvm15-dev clang15-libclang clang15 rust-bindgen git
@@ -9,7 +9,7 @@ WORKDIR /root/shadowsocks-rust
RUN git clone --depth 1 --branch "v${VERSION}" https://github.com/shadowsocks/shadowsocks-rust.git .
RUN case "$TARGETARCH" in \
RUN case "$TARGETPLATFORM" in \
"386") \
RUST_TARGET="i686-unknown-linux-musl" \
MUSL="i686-linux-musl" \
@@ -22,8 +22,12 @@ RUN case "$TARGETARCH" in \
RUST_TARGET="aarch64-unknown-linux-musl" \
MUSL="aarch64-linux-musl" \
;; \
"linux/arm/v7") \
RUST_TARGET="arm-unknown-linux-musleabihf" \
MUSL="arm-linux-musleabihf" \
;; \
*) \
echo "Doesn't support $TARGETARCH architecture" \
echo "Doesn't support $TARGETPLATFORM architecture" \
exit 1 \
;; \
esac \