Browse Source

build image based on alpine/musl

pull/212/head
Paper-Dragon 12 months ago
parent
commit
76fbb718b0
  1. 15
      .github/workflows/publish-docker.yml
  2. 18
      Dockerfile.alpine
  3. 0
      Dockerfile.ubuntu
  4. 2
      README.md

15
.github/workflows/publish-docker.yml

@ -50,11 +50,22 @@ jobs:
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
- name: Build gnu and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile.ubuntu
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}-ubuntu
labels: ${{ steps.meta.outputs.labels }}
- name: Build musl and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
platforms: linux/amd64
context: .
file: Dockerfile.alpine
push: true
tags: ${{ steps.meta.outputs.tags }}-apline
labels: ${{ steps.meta.outputs.labels }}

18
Dockerfile.alpine

@ -0,0 +1,18 @@
####################################################################################################
## Builder
####################################################################################################
FROM rust:latest AS builder
WORKDIR /worker
COPY ./ .
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --release --target x86_64-unknown-linux-musl
####################################################################################################
## Final image
####################################################################################################
FROM alpine:latest
RUN apk add iproute2 && apk cache clean
COPY --from=builder /worker/target/x86_64-unknown-linux-musl/release/tun2proxy-bin /usr/bin/tun2proxy-bin
ENTRYPOINT ["/usr/bin/tun2proxy-bin", "--setup"]

0
Dockerfile → Dockerfile.ubuntu

2
README.md

@ -212,7 +212,7 @@ services:
cap_add:
- NET_ADMIN
container_name: tun2proxy
image: ghcr.io/tun2proxy/tun2proxy:latest
image: ghcr.io/tun2proxy/tun2proxy:latest-ubuntu
command: --proxy proto://[username[:password]@]host:port
alpine:
stdin_open: true

Loading…
Cancel
Save