Skip to content

Commit

Permalink
feat: add docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
tscuite committed Apr 4, 2023
1 parent b0ee21b commit 854c74a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,37 @@ jobs:
args: release --rm-dist --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Deploy-to-dev:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set the value
id: release
run: |
TAG_NAME=${{ github.event.release.tag_name }}
ID=`echo ${TAG_NAME##v}`
echo "tag_version=$ID" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Aliyun Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.ALIYUN_REGISTRY }}
username: ${{ secrets.ALIYUN_DOCKERHUB_USER }}
password: ${{ secrets.ALIYUN_DOCKERHUB_PASSWORD }}

- name: Build and push xray
uses: docker/build-push-action@v3
with:
file: ./Dockerfile
context: ./
platforms: linux/amd64,linux/arm64
push: true
tags: |
registry.cn-beijing.aliyuncs.com/huoxian_pub/usb:v${{ env.tag_version }}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM golang:alpine as builder

WORKDIR /opt
COPY . .

RUN go env -w GO111MODULE=on \
&& go env -w CGO_ENABLED=0 \
&& go env \
&& go mod tidy \
&& go build -o usb .

FROM alpine:latest

WORKDIR /opt/

COPY --from=0 /opt/usb ./

EXPOSE 5005
ENTRYPOINT ./usb
19 changes: 19 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3"
services:
xray:
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/xray:v${{ env.tag_version }}
restart: always

usb:
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/usb:v${{ env.tag_version }}
restart: always
volumes:
- ./config-tutorial.ini:/opt/config-tutorial.ini

mitmproxy:
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/mitmproxy:v${{ env.tag_version }}
restart: always
environment:
XRAY_URL: 'xray'
ports:
- '10802:10802'

0 comments on commit 854c74a

Please sign in to comment.