Skip to content
Closed
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
48 changes: 44 additions & 4 deletions .github/workflows/docker-build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,53 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
build-binaries:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.0'
check-latest: true

- name: Build binary for ${{ matrix.arch }}
run: |
GOOS=linux GOARCH=${{ matrix.arch }} make build

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: gozargah-node-linux-${{ matrix.arch }}
path: gozargah-node-linux-${{ matrix.arch }}
retention-days: 1

build-and-push-docker:
needs: build-binaries
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download all binary artifacts
uses: actions/download-artifact@v4

- name: Move binaries to correct location
run: |
ls -la
chmod +x */gozargah-node-linux-*
mkdir -p binaries
find . -name "gozargah-node-linux-*" -type f -exec cp {} binaries/ \;
ls -la binaries/

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -33,6 +70,9 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -46,12 +86,12 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.multi
platforms: linux/amd64,linux/arm64
push: true
tags: |
m03ed/gozargah-node:${{ github.ref_name }}
ghcr.io/m03ed/gozargah-node:${{ github.ref_name }}

labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
47 changes: 44 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,53 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
build-binaries:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.0'
check-latest: true

- name: Build binary for ${{ matrix.arch }}
run: |
GOOS=linux GOARCH=${{ matrix.arch }} make build

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: gozargah-node-linux-${{ matrix.arch }}
path: gozargah-node-linux-${{ matrix.arch }}
retention-days: 1

build-and-push-docker:
needs: build-binaries
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download all binary artifacts
uses: actions/download-artifact@v4

- name: Move binaries to correct location
run: |
ls -la
chmod +x */gozargah-node-linux-*
mkdir -p binaries
find . -name "gozargah-node-linux-*" -type f -exec cp {} binaries/ \;
ls -la binaries/

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -32,6 +69,9 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -56,9 +96,10 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.multi
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.DOCKER_TAGS }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM golang:1.24.0 as builder
FROM golang:1.24.0 as base

WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .

COPY . .
FROM base as builder
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o main -ldflags="-w -s" .
Expand Down
16 changes: 16 additions & 0 deletions Dockerfile.multi
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:latest

RUN apk update && apk add --no-cache make

RUN mkdir /app
WORKDIR /app

COPY Makefile .

ARG TARGETARCH
COPY gozargah-node-linux-${TARGETARCH} /app/main
RUN chmod +x /app/main

RUN make install_xray

ENTRYPOINT ["./main", "serve"]
2 changes: 1 addition & 1 deletion backend/xray/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func setupUserAccount(user *common.User) (api.ProxySettings, error) {
settings.Trojan = api.NewTrojanAccount(user)
}

if user.GetProxies().GetTrojan() != nil {
if user.GetProxies().GetShadowsocks() != nil {
settings.Shadowsocks = api.NewShadowsocksTcpAccount(user)
settings.Shadowsocks2022 = api.NewShadowsocksAccount(user)
}
Expand Down