Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
*.out
out
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Docker Image CI

on:
push:
branches: [ master ]
tags: [ v* ]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- 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 GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: docker-meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=sha,prefix=
type=ref,event=tag
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=local,dest=${{ github.workspace }}/out

- name: Get metadata for artifact naming
id: meta
run: |
echo "commit-hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "repo-name=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT
- name: Upload built binaries
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.repo-name }}-${{ steps.meta.outputs.commit-hash }}
path: ${{ github.workspace }}/out
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.o
*.out
out

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine AS builder
RUN apk add --no-cache make gcc libc-dev
WORKDIR /app
ENV LDFLAGS=-static
COPY . .
RUN make

FROM scratch
LABEL org.opencontainers.image.licenses=MIT
COPY --from=builder /app/microsocks /
ENTRYPOINT ["/microsocks"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ Supported SOCKS5 Features
- IPv4, IPv6, DNS
- TCP (no UDP at this time)

Docker container
----------------
You can run microsocks in a docker container:

docker run --init -d -p 7777:1080 ghcr.io/rofl0r/microsocks

Replace 7777 with the port microsocks will be accessible on.

Troubleshooting
---------------

Expand Down