Skip to content
Merged
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
25 changes: 1 addition & 24 deletions .github/workflows/docker-build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ env:
REGISTRY: ghcr.io
IMAGE: pasarguard/${{ github.event.repository.name }}:${{ github.ref_name }}
GHCR_IMAGE: ghcr.io/pasarguard/${{ github.event.repository.name }}:${{ github.ref_name }}
BINARY_NAME: pasarguard-node-linux

jobs:
build-and-push:
Expand All @@ -20,25 +19,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Build binaries for all architectures
run: |
mkdir -p binaries
# Build for amd64
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 make build
mv ${{env.BINARY_NAME}}-amd64 binaries/

# Build for arm64
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 make build
mv ${{env.BINARY_NAME}}-arm64 binaries/

ls -la binaries/

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -51,9 +31,6 @@ jobs:
registry: ghcr.io
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 @@ -62,7 +39,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.multi
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
Expand Down
26 changes: 1 addition & 25 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:
GHCR_IMAGE: ghcr.io/pasarguard/${{ github.event.repository.name }}:${{ github.ref_name }}
IMAGE_LATEST: pasarguard/${{ github.event.repository.name }}:latest
GHCR_IMAGE_LATEST: ghcr.io/pasarguard/${{ github.event.repository.name }}:latest
BINARY_NAME: pasarguard-node-linux

jobs:
build-and-push:
Expand All @@ -22,25 +21,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Build binaries for all architectures
run: |
mkdir -p binaries
# Build for amd64
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 make build
mv ${{env.BINARY_NAME}}-amd64 binaries/

# Build for arm64
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 make build
mv ${{env.BINARY_NAME}}-arm64 binaries/

ls -la binaries/

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -54,9 +34,6 @@ 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 @@ -81,10 +58,9 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.multi
file: ./Dockerfile
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
33 changes: 17 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
FROM golang:1.25.1 as base
FROM --platform=$BUILDPLATFORM golang:1.25.1-alpine AS builder

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

FROM base as builder
ARG TARGETOS
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o main -ldflags="-w -s" .

FROM alpine:latest

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

RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/main .
COPY Makefile .
WORKDIR /src

COPY go* .
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} make NAME=main build
RUN make install_xray

ENTRYPOINT ["./main"]
FROM gcr.io/distroless/static-debian12

LABEL org.opencontainers.image.source="https://github.com/PasarGuard/node"

WORKDIR /app
COPY --from=builder /src /app
COPY --from=builder /usr/local/bin/xray /usr/local/bin/xray
COPY --from=builder /usr/local/share/xray /usr/local/share/xray

ENTRYPOINT ["./main"]
16 changes: 0 additions & 16 deletions Dockerfile.multi

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ ifeq ($(UNAME_S),Linux)
if [ "$(DISTRO)" = "debian" ] || [ "$(DISTRO)" = "ubuntu" ] || \
[ "$(DISTRO)" = "centos" ] || [ "$(DISTRO)" = "rhel" ] || [ "$(DISTRO)" = "fedora" ] || \
[ "$(DISTRO)" = "arch" ]; then \
sudo bash -c "$$(curl -L https://github.com/Gozargah/Marzban-scripts/raw/master/install_latest_xray.sh)"; \
sudo bash -c "$$(curl -L https://github.com/PasarGuard/scripts/raw/main/install_core.sh)"; \
else \
bash -c "$$(curl -L https://github.com/Gozargah/Marzban-scripts/raw/master/install_latest_xray.sh)"; \
bash -c "$$(curl -L https://github.com/PasarGuard/scripts/raw/main/install_core.sh)"; \
fi

else
Expand Down