mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-28 19:50:00 +00:00
fix: support multi-arch musl builds in Dockerfile
This commit is contained in:
parent
0cf4427ef6
commit
3baa41a1fb
2 changed files with 8 additions and 5 deletions
4
.github/workflows/publish-docker.yml
vendored
4
.github/workflows/publish-docker.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: Create and publish a Docker image
|
||||
name: Publish Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -18,8 +18,10 @@ env:
|
|||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
name: Build and push Docker image
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ 'scratch', 'ubuntu', 'alpine' ]
|
||||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
|
||||
|
|
|
@ -21,8 +21,9 @@ FROM rust:latest AS musl-builder
|
|||
|
||||
WORKDIR /worker
|
||||
COPY ./ .
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
RUN cargo build --release --target x86_64-unknown-linux-musl
|
||||
RUN ARCH=$(rustc -vV | sed -nE 's/host:\s*([^-]+).*/\1/p') \
|
||||
&& rustup target add "$ARCH-unknown-linux-musl" \
|
||||
&& cargo build --release --target "$ARCH-unknown-linux-musl"
|
||||
|
||||
RUN mkdir /.etc \
|
||||
&& touch /.etc/resolv.conf \
|
||||
|
@ -35,7 +36,7 @@ FROM rust:latest AS musl-builder
|
|||
####################################################################################################
|
||||
FROM alpine:latest AS tun2proxy-alpine
|
||||
|
||||
COPY --from=musl-builder /worker/target/x86_64-unknown-linux-musl/release/tun2proxy-bin /usr/bin/tun2proxy-bin
|
||||
COPY --from=musl-builder /worker/target/*/release/tun2proxy-bin /usr/bin/tun2proxy-bin
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tun2proxy-bin", "--setup"]
|
||||
|
||||
|
@ -55,6 +56,6 @@ FROM scratch AS tun2proxy-scratch
|
|||
|
||||
COPY --from=musl-builder ./tmp /tmp
|
||||
COPY --from=musl-builder ./etc /etc
|
||||
COPY --from=musl-builder /worker/target/x86_64-unknown-linux-musl/release/tun2proxy-bin /usr/bin/tun2proxy-bin
|
||||
COPY --from=musl-builder /worker/target/*/release/tun2proxy-bin /usr/bin/tun2proxy-bin
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tun2proxy-bin", "--setup"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue