From 88cde18bb2f92f4bc0e782b6635567c8c8f82a82 Mon Sep 17 00:00:00 2001 From: Mahbod <74229780+M4hbod@users.noreply.github.com> Date: Mon, 8 May 2023 02:55:06 +0330 Subject: [PATCH 01/29] update .ant-modal ui --- web/assets/ant-design-vue@1.7.2/antd.min.css | 4 ++-- web/assets/css/custom.css | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/assets/ant-design-vue@1.7.2/antd.min.css b/web/assets/ant-design-vue@1.7.2/antd.min.css index 846bbe54..a9cda542 100644 --- a/web/assets/ant-design-vue@1.7.2/antd.min.css +++ b/web/assets/ant-design-vue@1.7.2/antd.min.css @@ -3532,9 +3532,9 @@ to{max-height:0;padding:0;opacity:0} .ant-modal-close{position:absolute;top:0;right:0;z-index:10;padding:0;color:rgba(0,0,0,.45);font-weight:700;line-height:1;text-decoration:none;background:0 0;border:0;outline:0;cursor:pointer;transition:color .3s} .ant-modal-close-x{display:block;width:56px;height:56px;font-size:16px;font-style:normal;line-height:56px;text-align:center;text-transform:none;text-rendering:auto} .ant-modal-close:focus,.ant-modal-close:hover{color:rgba(0,0,0,.75);text-decoration:none} -.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,.65);background:#fff;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0} +.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,.65);background:#fff;border-bottom:1px solid rgb(153 153 153 / 20%);border-radius:4px 4px 0 0} .ant-modal-body{padding:24px;font-size:14px;line-height:1.5;word-wrap:break-word} -.ant-modal-footer{padding:10px 16px;text-align:right;background:0 0;border-top:1px solid #e8e8e8;border-radius:0 0 4px 4px} +.ant-modal-footer{padding:10px 16px;text-align:right;background:0 0;border-top:1px solid rgb(153 153 153 / 20%);border-radius:0 0 4px 4px} .ant-modal-footer button+button{margin-bottom:0;margin-left:8px} .ant-modal.zoom-appear,.ant-modal.zoom-enter{transform:none;opacity:0;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} .ant-modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;height:100%;background-color:rgba(0,0,0,.45);filter:alpha(opacity=50)} diff --git a/web/assets/css/custom.css b/web/assets/css/custom.css index d0deb71c..55d24888 100644 --- a/web/assets/css/custom.css +++ b/web/assets/css/custom.css @@ -268,15 +268,15 @@ .ant-dropdown-menu-dark, .ant-card-dark .ant-modal-content { - border: 1px solid rgba(255, 255, 255, 0.65); - box-shadow: 0 2px 8px rgba(255,255,255,.15); + border: 1px solid rgb(153 153 153 / 20%); + box-shadow: 0 1px 10px -1px #0000005c; } .ant-card-dark .ant-modal-content, .ant-card-dark .ant-modal-body, .ant-card-dark .ant-modal-header { color: hsla(0,0%,100%,.65); - background-color: #222a37; + background-color: #1a212a; } .ant-card-dark .ant-calendar-selected-day .ant-calendar-date { From 5e3e965647ae379276a79e5657e31ad09121e8db Mon Sep 17 00:00:00 2001 From: Mahbod <74229780+M4hbod@users.noreply.github.com> Date: Mon, 8 May 2023 03:36:52 +0330 Subject: [PATCH 02/29] add margin to .ant-modal --- web/assets/ant-design-vue@1.7.2/antd.min.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/assets/ant-design-vue@1.7.2/antd.min.css b/web/assets/ant-design-vue@1.7.2/antd.min.css index a9cda542..3135fe4f 100644 --- a/web/assets/ant-design-vue@1.7.2/antd.min.css +++ b/web/assets/ant-design-vue@1.7.2/antd.min.css @@ -3532,9 +3532,9 @@ to{max-height:0;padding:0;opacity:0} .ant-modal-close{position:absolute;top:0;right:0;z-index:10;padding:0;color:rgba(0,0,0,.45);font-weight:700;line-height:1;text-decoration:none;background:0 0;border:0;outline:0;cursor:pointer;transition:color .3s} .ant-modal-close-x{display:block;width:56px;height:56px;font-size:16px;font-style:normal;line-height:56px;text-align:center;text-transform:none;text-rendering:auto} .ant-modal-close:focus,.ant-modal-close:hover{color:rgba(0,0,0,.75);text-decoration:none} -.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,.65);background:#fff;border-bottom:1px solid rgb(153 153 153 / 20%);border-radius:4px 4px 0 0} +.ant-modal-header{padding:16px 24px;color:rgba(0,0,0,.65);background:#fff;border-bottom:1px solid rgb(153 153 153 / 20%);border-radius:4px 4px 0 0;margin:.1rem .5rem 0 .5rem} .ant-modal-body{padding:24px;font-size:14px;line-height:1.5;word-wrap:break-word} -.ant-modal-footer{padding:10px 16px;text-align:right;background:0 0;border-top:1px solid rgb(153 153 153 / 20%);border-radius:0 0 4px 4px} +.ant-modal-footer{padding:10px 16px;text-align:right;background:0 0;border-top:1px solid rgb(153 153 153 / 20%);border-radius:0 0 4px 4px;margin:0 .5rem 0 .5rem} .ant-modal-footer button+button{margin-bottom:0;margin-left:8px} .ant-modal.zoom-appear,.ant-modal.zoom-enter{transform:none;opacity:0;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} .ant-modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;height:100%;background-color:rgba(0,0,0,.45);filter:alpha(opacity=50)} From 77692e029846df3808d8865a9b3e2ec6f67ba218 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 01:18:23 +0330 Subject: [PATCH 03/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 676ea92c..310dbf21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-\${TARGETARCH} + && mv xray xray-linux-${TARGETARCH} WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From c727b817723fae11daf7b5f10791a3501b0dcddb Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 01:59:07 +0330 Subject: [PATCH 04/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 310dbf21..db57b16c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ # Use the official Golang image as the base image -FROM golang:1.20 as builder - ARG TARGETARCH ARG TARGETOS +FROM golang:1.20 as builder # Set up the working directory WORKDIR /app @@ -49,6 +48,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh +RUN apt install tzdata ca-certificates # Set the entrypoint -ENTRYPOINT ["/app/x-ui/x-ui.sh"] +ENTRYPOINT ["/app/x-ui/xui-release"] From 20a55c086e6982401b1de74c75aa126c9f5bc048 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 02:01:59 +0330 Subject: [PATCH 05/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index db57b16c..9dd30715 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ ARG TARGETARCH ARG TARGETOS FROM golang:1.20 as builder - +ARG TARGETARCH +ARG TARGETOS # Set up the working directory WORKDIR /app @@ -20,7 +21,7 @@ RUN CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o xui-release- FROM ubuntu:20.04 ARG TARGETARCH - +ARG TARGETOS # Set up the working directory WORKDIR /app From 15a97af2150ae5e3056e15f9b054ee36bba04558 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 02:09:33 +0330 Subject: [PATCH 06/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9dd30715..f87e3ca2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN go mod download COPY . . # Build the X-ui binary -RUN CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o xui-release-${TARGETARCH} -v main.go +RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go # Start a new stage using the base image FROM ubuntu:20.04 @@ -26,7 +26,7 @@ ARG TARGETOS WORKDIR /app # Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release-${TARGETARCH} /app/x-ui/xui-release +COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh @@ -45,7 +45,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-${TARGETARCH} + && mv xray xray-linux-$TARGETARCH WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From f21904caf2cb36e14647576030124efb811b89cf Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 02:10:31 +0330 Subject: [PATCH 07/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f87e3ca2..e03454c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh -RUN apt install tzdata ca-certificates +RUN apt update && apt install tzdata ca-certificates # Set the entrypoint ENTRYPOINT ["/app/x-ui/xui-release"] From efecdf5fd0459d8e740f431ac0fe25bc105b6e13 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 02:43:48 +0330 Subject: [PATCH 08/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e03454c3..33909aaf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,8 @@ COPY x-ui.sh /app/x-ui/x-ui.sh RUN apt-get update && apt-get install -y \ wget \ unzip \ + tzdata \ + ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app/x-ui/bin @@ -49,7 +51,6 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh -RUN apt update && apt install tzdata ca-certificates # Set the entrypoint ENTRYPOINT ["/app/x-ui/xui-release"] From 13e3e23f200081ded47afd0d6dcffe56ee1b5cde Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 03:17:38 +0330 Subject: [PATCH 09/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 2 +- Dockerfile | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fc2194a5..73dd7b4a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -36,6 +36,6 @@ jobs: with: context: . push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64, linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 33909aaf..59899e09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ # Use the official Golang image as the base image -ARG TARGETARCH +FROM --platform=$BUILDPLATFORM golang:1.20 as builder ARG TARGETOS -FROM golang:1.20 as builder ARG TARGETARCH -ARG TARGETOS # Set up the working directory WORKDIR /app @@ -15,7 +13,7 @@ RUN go mod download COPY . . # Build the X-ui binary -RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go +RUN CGO_ENABLED=1 GOOS=\${TARGETOS} GOARCH=\${TARGETARCH} go build -o xui-release-\${TARGETARCH} -v main.go # Start a new stage using the base image FROM ubuntu:20.04 @@ -26,7 +24,7 @@ ARG TARGETOS WORKDIR /app # Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release +COPY --from=builder /app/xui-release-\${TARGETARCH} /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh @@ -47,7 +45,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-$TARGETARCH + && mv xray xray-linux-\${TARGETARCH} WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From 7b567458ffa4a06c94a2c0f1d999011c7f5e4eec Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 03:35:52 +0330 Subject: [PATCH 10/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 14 +++++++------- Dockerfile | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 73dd7b4a..a3160e84 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,15 +11,15 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v2.1.0 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 + uses: docker/setup-buildx-action@v2 - name: Log in to GitHub Container Registry - uses: docker/login-action@v2.1.0 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} @@ -27,15 +27,15 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v4.4.0 + uses: docker/metadata-action@v4 with: images: ghcr.io/${{ github.repository }} - name: Build and push Docker image - uses: docker/build-push-action@v4.0.0 + uses: docker/build-push-action@v4 with: context: . push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64, linux/arm64 + platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 59899e09..583c4001 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Use the official Golang image as the base image +ARG TARGETOS TARGETARCH FROM --platform=$BUILDPLATFORM golang:1.20 as builder -ARG TARGETOS -ARG TARGETARCH +ARG TARGETOS TARGETARCH # Set up the working directory WORKDIR /app @@ -13,18 +13,17 @@ RUN go mod download COPY . . # Build the X-ui binary -RUN CGO_ENABLED=1 GOOS=\${TARGETOS} GOARCH=\${TARGETARCH} go build -o xui-release-\${TARGETARCH} -v main.go +RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go # Start a new stage using the base image FROM ubuntu:20.04 -ARG TARGETARCH -ARG TARGETOS +ARG TARGETOS TARGETARCH # Set up the working directory WORKDIR /app # Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release-\${TARGETARCH} /app/x-ui/xui-release +COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh @@ -45,7 +44,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-\${TARGETARCH} + && mv xray xray-linux-$TARGETARCH WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From b1a302de95a07660eecb09d1c7b73b1ed4c3f200 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 03:47:11 +0330 Subject: [PATCH 11/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 583c4001..9c54e21d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,14 @@ ARG TARGETOS TARGETARCH FROM --platform=$BUILDPLATFORM golang:1.20 as builder ARG TARGETOS TARGETARCH +RUN echo "TARGETOS=$TARGETOS TARGETARCH=$TARGETARCH" # Set up the working directory WORKDIR /app # Copy the Go modules and download the dependencies COPY go.mod go.sum ./ RUN go mod download - +RUN echo "GOOS=$TARGETOS GOARCH=$TARGETARCH" > /app/.env # Copy the source code COPY . . @@ -17,13 +18,14 @@ RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TAR # Start a new stage using the base image FROM ubuntu:20.04 - ARG TARGETOS TARGETARCH +RUN echo "TARGETOS=$TARGETOS TARGETARCH=$TARGETARCH" # Set up the working directory WORKDIR /app # Copy the X-ui binary and required files from the builder stage COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release +COPY --from=builder /app/.env /app/x-ui/.env COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh From 50c296eb28707da6e6d9001f4d2fdf26ce54f8e4 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 03:49:47 +0330 Subject: [PATCH 12/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9c54e21d..be19f0f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ # Use the official Golang image as the base image -ARG TARGETOS TARGETARCH FROM --platform=$BUILDPLATFORM golang:1.20 as builder ARG TARGETOS TARGETARCH RUN echo "TARGETOS=$TARGETOS TARGETARCH=$TARGETARCH" From a25137f215da573831ebb8b04165a9e787c94c61 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 03:56:09 +0330 Subject: [PATCH 13/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index be19f0f1..0d36d93b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN echo "GOOS=$TARGETOS GOARCH=$TARGETARCH" > /app/.env COPY . . # Build the X-ui binary -RUN CGO_ENABLED=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go +RUN CGO_ENABLED=۰ GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go # Start a new stage using the base image FROM ubuntu:20.04 From 5c6406ab58517a34180ea6ae2d2e401bca112d9d Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 03:59:54 +0330 Subject: [PATCH 14/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0d36d93b..876c4a57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,10 @@ RUN echo "GOOS=$TARGETOS GOARCH=$TARGETARCH" > /app/.env COPY . . # Build the X-ui binary -RUN CGO_ENABLED=۰ GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go +RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go # Start a new stage using the base image FROM ubuntu:20.04 -ARG TARGETOS TARGETARCH -RUN echo "TARGETOS=$TARGETOS TARGETARCH=$TARGETARCH" # Set up the working directory WORKDIR /app @@ -45,7 +43,8 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-$TARGETARCH + && arch=(dpkg --print-architecture) \ + && mv xray xray-linux-$arch WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From bb9a10051fcf4513bd6eb0192fe9946943778922 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 04:02:54 +0330 Subject: [PATCH 15/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 876c4a57..5065bb88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ # Use the official Golang image as the base image FROM --platform=$BUILDPLATFORM golang:1.20 as builder ARG TARGETOS TARGETARCH -RUN echo "TARGETOS=$TARGETOS TARGETARCH=$TARGETARCH" # Set up the working directory WORKDIR /app From abd48551fd87f0a2c5770de8c07273a4c2964385 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 04:18:32 +0330 Subject: [PATCH 16/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5065bb88..8f499c0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,16 @@ # Use the official Golang image as the base image FROM --platform=$BUILDPLATFORM golang:1.20 as builder -ARG TARGETOS TARGETARCH # Set up the working directory WORKDIR /app # Copy the Go modules and download the dependencies COPY go.mod go.sum ./ RUN go mod download -RUN echo "GOOS=$TARGETOS GOARCH=$TARGETARCH" > /app/.env # Copy the source code COPY . . - +ARG TARGETOS TARGETARCH # Build the X-ui binary -RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go # Start a new stage using the base image FROM ubuntu:20.04 @@ -21,7 +19,6 @@ WORKDIR /app # Copy the X-ui binary and required files from the builder stage COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release -COPY --from=builder /app/.env /app/x-ui/.env COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh From 0a8cf7e41bb712b6ac6d410ff6e129d2e252535f Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 04:25:14 +0330 Subject: [PATCH 17/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8f499c0b..64d57d78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v mai FROM ubuntu:20.04 # Set up the working directory WORKDIR /app - +ARG TARGETOS TARGETARCH # Copy the X-ui binary and required files from the builder stage COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service From b4fd254c71b889e3227e33ae347f997ccd6d81a4 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 04:38:04 +0330 Subject: [PATCH 18/29] =?UTF-8?q?=F0=9F=91=B7=20Added=20Docker=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a3160e84..48d1a223 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -36,6 +36,6 @@ jobs: with: context: . push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From f286c9a86a7628923078a1bd9dff65284536ff5b Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 04:48:25 +0330 Subject: [PATCH 19/29] Added ARM64 --- .github/DockerfileARM | 47 ++++++++++++++++++++++++++++++++++++ .github/workflows/docker.yml | 10 ++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/DockerfileARM diff --git a/.github/DockerfileARM b/.github/DockerfileARM new file mode 100644 index 00000000..148a4f1a --- /dev/null +++ b/.github/DockerfileARM @@ -0,0 +1,47 @@ +# Use the official Golang image as the base image +FROM golang:1.20 as builder +# Set up the working directory +WORKDIR /app + +# Copy the Go modules and download the dependencies +COPY go.mod go.sum ./ +RUN go mod download +# Copy the source code +COPY . . +RUN apt update && apt install gcc-aarch64-linux-gnu -y +# Build the X-ui binary +RUN GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release-arm64 -v main.go + +# Start a new stage using the base image +FROM ubuntu:20.04 +# Set up the working directory +WORKDIR /app +# Copy the X-ui binary and required files from the builder stage +COPY --from=builder /app/xui-release-arm64 /app/x-ui/xui-release +COPY x-ui.service /app/x-ui/x-ui.service +COPY x-ui.sh /app/x-ui/x-ui.sh + +# Set up the runtime environment +RUN apt-get update && apt-get install -y \ + wget \ + unzip \ + tzdata \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app/x-ui/bin + +# Download and set up the required files +RUN wget https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip \ + && unzip Xray-linux-arm64-v8a.zip \ + && rm -f Xray-linux-arm64-v8a.zip geoip.dat geosite.dat iran.dat \ + && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ + && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ + && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ + && mv xray xray-linux-arm64 + +WORKDIR /app +RUN chmod +x /app/x-ui/x-ui.sh + +# Set the entrypoint +ENTRYPOINT ["/app/x-ui/xui-release"] diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 48d1a223..053b6833 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,3 +39,13 @@ jobs: platforms: linux/amd64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + - name: Build and push Docker image ARM64 + uses: docker/build-push-action@v4 + with: + context: . + file: .github/DockerfileARM + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 2141d620695dc13c97ba1b8851248d71fa3ce4a5 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 04:50:39 +0330 Subject: [PATCH 20/29] Fixed Dockerfile --- Dockerfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 64d57d78..bf89cb1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,17 +8,15 @@ COPY go.mod go.sum ./ RUN go mod download # Copy the source code COPY . . -ARG TARGETOS TARGETARCH # Build the X-ui binary -RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o xui-release-$TARGETARCH -v main.go +RUN GOOS=linux GOARCH=amd64 go build -o xui-release-amd64 -v main.go # Start a new stage using the base image FROM ubuntu:20.04 # Set up the working directory WORKDIR /app -ARG TARGETOS TARGETARCH # Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release-$TARGETARCH /app/x-ui/xui-release +COPY --from=builder /app/xui-release-amd64 /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh @@ -39,8 +37,7 @@ RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-lin && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && arch=(dpkg --print-architecture) \ - && mv xray xray-linux-$arch + && mv xray xray-linux-amd64 WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From c73c71cc83fc48581c49cf1698d05fbc7aa54fe3 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 05:40:36 +0330 Subject: [PATCH 21/29] Fixed Dockerfile --- .github/DockerfileARM | 47 ------------------------------------ .github/workflows/docker.yml | 12 +-------- Dockerfile | 30 ++++++++++++++++++++--- 3 files changed, 27 insertions(+), 62 deletions(-) delete mode 100644 .github/DockerfileARM diff --git a/.github/DockerfileARM b/.github/DockerfileARM deleted file mode 100644 index 148a4f1a..00000000 --- a/.github/DockerfileARM +++ /dev/null @@ -1,47 +0,0 @@ -# Use the official Golang image as the base image -FROM golang:1.20 as builder -# Set up the working directory -WORKDIR /app - -# Copy the Go modules and download the dependencies -COPY go.mod go.sum ./ -RUN go mod download -# Copy the source code -COPY . . -RUN apt update && apt install gcc-aarch64-linux-gnu -y -# Build the X-ui binary -RUN GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release-arm64 -v main.go - -# Start a new stage using the base image -FROM ubuntu:20.04 -# Set up the working directory -WORKDIR /app -# Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release-arm64 /app/x-ui/xui-release -COPY x-ui.service /app/x-ui/x-ui.service -COPY x-ui.sh /app/x-ui/x-ui.sh - -# Set up the runtime environment -RUN apt-get update && apt-get install -y \ - wget \ - unzip \ - tzdata \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /app/x-ui/bin - -# Download and set up the required files -RUN wget https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip \ - && unzip Xray-linux-arm64-v8a.zip \ - && rm -f Xray-linux-arm64-v8a.zip geoip.dat geosite.dat iran.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ - && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-arm64 - -WORKDIR /app -RUN chmod +x /app/x-ui/x-ui.sh - -# Set the entrypoint -ENTRYPOINT ["/app/x-ui/xui-release"] diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 053b6833..d2c2629a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -36,16 +36,6 @@ jobs: with: context: . push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Build and push Docker image ARM64 - uses: docker/build-push-action@v4 - with: - context: . - file: .github/DockerfileARM - push: ${{ github.event_name != 'pull_request' }} - platforms: linux/arm64 + platforms: linux/amd64, linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index bf89cb1d..810f9ca9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # Use the official Golang image as the base image FROM --platform=$BUILDPLATFORM golang:1.20 as builder + # Set up the working directory WORKDIR /app @@ -8,15 +9,23 @@ COPY go.mod go.sum ./ RUN go mod download # Copy the source code COPY . . +ARG TARGETPARCH +RUN if $TARGETPARCH == "arm64"; then apt update && apt install gcc-aarch64-linux-gnu -y; fi # Build the X-ui binary -RUN GOOS=linux GOARCH=amd64 go build -o xui-release-amd64 -v main.go +RUN if $TARGETPARCH == "arm64"; then GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release-arm64 -v main.go; fi +RUN if $TARGETPARCH == "amd64"; then GOOS=linux GOARCH=amd64 go build -o xui-release-amd64 -v main.go; fi # Start a new stage using the base image FROM ubuntu:20.04 # Set up the working directory WORKDIR /app # Copy the X-ui binary and required files from the builder stage -COPY --from=builder /app/xui-release-amd64 /app/x-ui/xui-release +RUN arch=$(uname -m); \ + if [ "$arch" = "aarch64" ]; then \ + COPY --from=builder /app/xui-release-arm64 /app/x-ui/xui-release; \ + else \ + COPY --from=builder /app/xui-release-amd64 /app/x-ui/xui-release; \ + fi COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh @@ -31,13 +40,26 @@ RUN apt-get update && apt-get install -y \ WORKDIR /app/x-ui/bin # Download and set up the required files -RUN wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ + +RUN if [ "$arch" = "aarch64" ]; then \ + wget https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip \ + && unzip Xray-linux-arm64-v8a.zip \ + && rm -f Xray-linux-arm64-v8a.zip geoip.dat geosite.dat iran.dat \ + && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ + && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ + && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ + && mv xray xray-linux-arm64 \ + fi + +RUN if [ "$arch" = "amd64" ]; then \ + wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ && unzip Xray-linux-64.zip \ && rm -f Xray-linux-64.zip geoip.dat geosite.dat iran.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-amd64 + && mv xray xray-linux-amd64 \ + fi WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From 52a468d586a7f15d0fcbdc6d98d63c916e7a4216 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 05:47:43 +0330 Subject: [PATCH 22/29] Fixed Dockerfile --- Dockerfile | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 810f9ca9..384226d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,20 +12,15 @@ COPY . . ARG TARGETPARCH RUN if $TARGETPARCH == "arm64"; then apt update && apt install gcc-aarch64-linux-gnu -y; fi # Build the X-ui binary -RUN if $TARGETPARCH == "arm64"; then GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release-arm64 -v main.go; fi -RUN if $TARGETPARCH == "amd64"; then GOOS=linux GOARCH=amd64 go build -o xui-release-amd64 -v main.go; fi +RUN if $TARGETPARCH == "arm64"; then GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; fi +RUN if $TARGETPARCH == "amd64"; then GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; fi # Start a new stage using the base image FROM ubuntu:20.04 # Set up the working directory WORKDIR /app # Copy the X-ui binary and required files from the builder stage -RUN arch=$(uname -m); \ - if [ "$arch" = "aarch64" ]; then \ - COPY --from=builder /app/xui-release-arm64 /app/x-ui/xui-release; \ - else \ - COPY --from=builder /app/xui-release-amd64 /app/x-ui/xui-release; \ - fi +COPY --from=builder /app/xui-release /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service COPY x-ui.sh /app/x-ui/x-ui.sh @@ -41,7 +36,8 @@ WORKDIR /app/x-ui/bin # Download and set up the required files -RUN if [ "$arch" = "aarch64" ]; then \ +RUN arch=$(uname -m) \ + if [ "$arch" = "aarch64" ]; then \ wget https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip \ && unzip Xray-linux-arm64-v8a.zip \ && rm -f Xray-linux-arm64-v8a.zip geoip.dat geosite.dat iran.dat \ @@ -51,8 +47,9 @@ RUN if [ "$arch" = "aarch64" ]; then \ && mv xray xray-linux-arm64 \ fi -RUN if [ "$arch" = "amd64" ]; then \ - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ +RUN arch=$(uname -m) \ + if [ "$arch" = "amd64" ]; then \ + wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ && unzip Xray-linux-64.zip \ && rm -f Xray-linux-64.zip geoip.dat geosite.dat iran.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ From e01fb9b605d048082b8ee814a80ba603a0d57404 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 05:52:48 +0330 Subject: [PATCH 23/29] Fixed Dockerfile --- Dockerfile | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 384226d4..cc08c571 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,18 +7,27 @@ WORKDIR /app # Copy the Go modules and download the dependencies COPY go.mod go.sum ./ RUN go mod download + # Copy the source code COPY . . + ARG TARGETPARCH -RUN if $TARGETPARCH == "arm64"; then apt update && apt install gcc-aarch64-linux-gnu -y; fi + +RUN if [ "$TARGETPARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-linux-gnu -y; fi + # Build the X-ui binary -RUN if $TARGETPARCH == "arm64"; then GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; fi -RUN if $TARGETPARCH == "amd64"; then GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; fi +RUN if [ "$TARGETPARCH" = "arm64" ]; then \ + GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ + elif [ "$TARGETPARCH" = "amd64" ]; then \ + GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ + fi # Start a new stage using the base image FROM ubuntu:20.04 + # Set up the working directory WORKDIR /app + # Copy the X-ui binary and required files from the builder stage COPY --from=builder /app/xui-release /app/x-ui/xui-release COPY x-ui.service /app/x-ui/x-ui.service @@ -35,28 +44,24 @@ RUN apt-get update && apt-get install -y \ WORKDIR /app/x-ui/bin # Download and set up the required files - -RUN arch=$(uname -m) \ - if [ "$arch" = "aarch64" ]; then \ +RUN arch=$(uname -m) && \ + if [ "$arch" = "aarch64" ]; then \ wget https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip \ && unzip Xray-linux-arm64-v8a.zip \ && rm -f Xray-linux-arm64-v8a.zip geoip.dat geosite.dat iran.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-arm64 \ - fi - -RUN arch=$(uname -m) \ - if [ "$arch" = "amd64" ]; then \ - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ - && unzip Xray-linux-64.zip \ - && rm -f Xray-linux-64.zip geoip.dat geosite.dat iran.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ - && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ - && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ - && mv xray xray-linux-amd64 \ - fi + && mv xray xray-linux-arm64; \ + elif [ "$arch" = "amd64" ]; then \ + wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ + && unzip Xray-linux-64.zip \ + && rm -f Xray-linux-64.zip geoip.dat geosite.dat iran.dat \ + && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \ + && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ + && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ + && mv xray xray-linux-amd64; \ + fi WORKDIR /app RUN chmod +x /app/x-ui/x-ui.sh From 9e5d7ac1d02308424ebd76c8cce89dcfada3b0ba Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 05:57:43 +0330 Subject: [PATCH 24/29] Fixed Dockerfile --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index cc08c571..aa5968ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Use the official Golang image as the base image FROM --platform=$BUILDPLATFORM golang:1.20 as builder - +ARG TARGETOS TARGETARCH # Set up the working directory WORKDIR /app @@ -13,12 +13,12 @@ COPY . . ARG TARGETPARCH -RUN if [ "$TARGETPARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-linux-gnu -y; fi +RUN if [ "$TARGETARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-linux-gnu -y; fi # Build the X-ui binary -RUN if [ "$TARGETPARCH" = "arm64" ]; then \ +RUN if [ "$TARGETARCH" = "arm64" ]; then \ GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ - elif [ "$TARGETPARCH" = "amd64" ]; then \ + elif [ "$TARGETARCH" = "amd64" ]; then \ GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ fi From 8011d0b6c6fb4bf4e690ac06d9689e7386195d91 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 06:07:08 +0330 Subject: [PATCH 25/29] Fixed Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aa5968ea..c311ca8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ RUN go mod download # Copy the source code COPY . . -ARG TARGETPARCH RUN if [ "$TARGETARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-linux-gnu -y; fi From 350743fea353855b0073561f4ea302139a85ff98 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 06:09:26 +0330 Subject: [PATCH 26/29] Enable CGO --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c311ca8b..b82a0f92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,9 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-l # Build the X-ui binary RUN if [ "$TARGETARCH" = "arm64" ]; then \ - GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ + TARGETARCH GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ elif [ "$TARGETARCH" = "amd64" ]; then \ - GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ + TARGETARCH GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ fi # Start a new stage using the base image From 89b94c2c9083ef8c6c58af6909c503b078abaa43 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 06:11:44 +0330 Subject: [PATCH 27/29] Enable CGO --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b82a0f92..6bcfaedc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,9 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then apt update && apt install gcc-aarch64-l # Build the X-ui binary RUN if [ "$TARGETARCH" = "arm64" ]; then \ - TARGETARCH GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ + CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o xui-release -v main.go; \ elif [ "$TARGETARCH" = "amd64" ]; then \ - TARGETARCH GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ + CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go; \ fi # Start a new stage using the base image From 77cee098ad618f6773c629d9e3e41457daf50b64 Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 06:20:33 +0330 Subject: [PATCH 28/29] Finally --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6bcfaedc..87df78bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,7 @@ RUN arch=$(uname -m) && \ && wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \ && wget https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \ && mv xray xray-linux-arm64; \ - elif [ "$arch" = "amd64" ]; then \ + elif [ "$arch" = "x86_64" ]; then \ wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip \ && unzip Xray-linux-64.zip \ && rm -f Xray-linux-64.zip geoip.dat geosite.dat iran.dat \ From ddbc1602ce5ac5d866447ab8feea31e6438118de Mon Sep 17 00:00:00 2001 From: itspooya Date: Mon, 8 May 2023 06:32:59 +0330 Subject: [PATCH 29/29] Finally - Fix WorkDIR --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 87df78bf..be21bd15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,7 +62,7 @@ RUN arch=$(uname -m) && \ && mv xray xray-linux-amd64; \ fi -WORKDIR /app +WORKDIR /app/x-ui RUN chmod +x /app/x-ui/x-ui.sh # Set the entrypoint