diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml new file mode 100644 index 0000000..f16f604 --- /dev/null +++ b/.github/workflows/build-docker.yaml @@ -0,0 +1,42 @@ +name: Build Docker + +on: + push: + branches: + - "main" + schedule: + - cron: "0 0 * * sun" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: zroxy + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GHCR + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + context: . + file: ./Dockerfile + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + platforms: | + linux/amd64 + linux/arm64 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3fbdc88 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:latest as builder + +RUN apk add --update alpine-sdk git cmake make + +WORKDIR /source + +RUN git clone https://github.com/0x7a657573/zroxy.git . \ + && mkdir build \ + && cd build \ + && cmake .. \ + && make + +FROM alpine:latest + +ARG USER=app +ARG HOME=/app + +ENV PATH=$PATH:/app + +RUN adduser -h $HOME -D $USER + +USER $USER +WORKDIR $HOME + +COPY --from=builder /source/build/zroxy . +ADD --chown=app:app ./zroxy.conf . + +CMD zroxy -c /app/zroxy.conf \ No newline at end of file diff --git a/zroxy.conf b/zroxy.conf new file mode 100644 index 0000000..b3ddf9f --- /dev/null +++ b/zroxy.conf @@ -0,0 +1,17 @@ +# set log level +# log level 0 -> LOG_TRACE, 1 -> LOG_DEBUG, +# 2 -> LOG_INFO, 3 -> LOG_WARN, +# 4 -> LOG_ERROR, 5 -> LOG_FATAL +# pattern: log = +# example: log = 3 +log = 2 + +# sni server set bind ip and port. +# pattern: port = :@ +# example: port = 127.0.0.1:8080@80,4433@433,853... +PORT = 0.0.0.0:80@80,443@443 + +# enable statistics monitor +# pattern : monitor = +# example: monitor = 8123 +MONITOR = 8123