mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 13:14:11 +00:00
Auto
This commit is contained in:
parent
1e7fabdce2
commit
645eab3f59
11 changed files with 299 additions and 9 deletions
9
.devcontainer/devcontainer-lock.json
Normal file
9
.devcontainer/devcontainer-lock.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
||||||
|
"version": "2.17.0",
|
||||||
|
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c",
|
||||||
|
"integrity": "sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
62
.github/workflows/docker.yml.orig
vendored
Normal file
62
.github/workflows/docker.yml.orig
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
name: Release 3X-UI for Docker
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v6
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
hsanaeii/3x-ui
|
||||||
|
ghcr.io/mhsanaei/3x-ui
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6,linux/386
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
|
@ -25,9 +25,9 @@
|
||||||
// Set to true to serve assets/templates directly from disk for development
|
// Set to true to serve assets/templates directly from disk for development
|
||||||
"XUI_DEBUG": "true",
|
"XUI_DEBUG": "true",
|
||||||
// Uncomment to override DB folder location (by default uses working dir on Windows when debug)
|
// Uncomment to override DB folder location (by default uses working dir on Windows when debug)
|
||||||
// "XUI_DB_FOLDER": "${workspaceFolder}",
|
"XUI_DB_FOLDER": "${workspaceFolder}",
|
||||||
// Example: override log level (debug|info|notice|warn|error)
|
// Example: override log level (debug|info|notice|warn|error)
|
||||||
// "XUI_LOG_LEVEL": "debug"
|
"XUI_LOG_LEVEL": "debug"
|
||||||
},
|
},
|
||||||
"console": "integratedTerminal"
|
"console": "integratedTerminal"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17
Dockerfile
17
Dockerfile
|
|
@ -1,7 +1,7 @@
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# Stage: Frontend (Vite)
|
# Stage: Frontend (Vite)
|
||||||
# ========================================================
|
# ========================================================
|
||||||
FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend
|
FROM --platform=$BUILDPLATFORM reg.vados.ru/node:22-alpine AS frontend
|
||||||
WORKDIR /src/frontend
|
WORKDIR /src/frontend
|
||||||
COPY frontend/package.json frontend/package-lock.json ./
|
COPY frontend/package.json frontend/package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
@ -12,7 +12,9 @@ RUN npm run build
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# Stage: Builder
|
# Stage: Builder
|
||||||
# ========================================================
|
# ========================================================
|
||||||
FROM golang:1.26-alpine AS builder
|
#ARG CI_REGISTRY=reg.vados.ru
|
||||||
|
FROM reg.vados.ru/golang:1.26-alpine AS builder
|
||||||
|
#FROM golang:1.26-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
|
@ -33,7 +35,8 @@ RUN ./DockerInit.sh "$TARGETARCH"
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# Stage: Final Image of 3x-ui
|
# Stage: Final Image of 3x-ui
|
||||||
# ========================================================
|
# ========================================================
|
||||||
FROM alpine
|
#FROM alpine
|
||||||
|
FROM reg.vados.ru/alpine
|
||||||
ENV TZ=Asia/Tehran
|
ENV TZ=Asia/Tehran
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
@ -43,13 +46,15 @@ RUN apk add --no-cache --update \
|
||||||
fail2ban \
|
fail2ban \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
openssl
|
openssl \
|
||||||
|
mc
|
||||||
|
|
||||||
COPY --from=builder /app/build/ /app/
|
COPY --from=builder /app/build/ /app/
|
||||||
COPY --from=builder /app/DockerEntrypoint.sh /app/
|
COPY --from=builder /app/DockerEntrypoint.sh /app/
|
||||||
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
|
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
|
||||||
COPY --from=builder /app/web/translation /app/web/translation
|
COPY --from=builder /app/web/translation /app/web/translation
|
||||||
|
|
||||||
|
ADD --from=builder config/mc.tar.gz /root/.config
|
||||||
|
|
||||||
# Configure fail2ban
|
# Configure fail2ban
|
||||||
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
|
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
|
||||||
|
|
@ -63,8 +68,8 @@ RUN chmod +x \
|
||||||
/app/x-ui \
|
/app/x-ui \
|
||||||
/usr/bin/x-ui
|
/usr/bin/x-ui
|
||||||
|
|
||||||
ENV XUI_ENABLE_FAIL2BAN="true"
|
ENV XUI_ENABLE_FAIL2BAN="false"
|
||||||
EXPOSE 2053
|
EXPOSE 2904
|
||||||
VOLUME [ "/etc/x-ui" ]
|
VOLUME [ "/etc/x-ui" ]
|
||||||
CMD [ "./x-ui" ]
|
CMD [ "./x-ui" ]
|
||||||
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
||||||
|
|
|
||||||
38
Dockerfile.diff
Normal file
38
Dockerfile.diff
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
2,12d1
|
||||||
|
< # Stage: Frontend (Vite)
|
||||||
|
< # ========================================================
|
||||||
|
< FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend
|
||||||
|
< WORKDIR /src/frontend
|
||||||
|
< COPY frontend/package.json frontend/package-lock.json ./
|
||||||
|
< RUN npm ci
|
||||||
|
< COPY frontend/ ./
|
||||||
|
< COPY web/translation /src/web/translation
|
||||||
|
< RUN npm run build
|
||||||
|
<
|
||||||
|
< # ========================================================
|
||||||
|
15,16c4,7
|
||||||
|
< FROM golang:1.26-alpine AS builder
|
||||||
|
< WORKDIR /app
|
||||||
|
---
|
||||||
|
> ARG CI_REGISTRY=reg.vados.ru
|
||||||
|
> ARG CI_BASE=${CI_REGISTRY}/golang:1.26-alpine
|
||||||
|
> FROM ${CI_BASE} AS builder
|
||||||
|
> WORKDIR "/app"
|
||||||
|
26d16
|
||||||
|
< COPY --from=frontend /src/web/dist ./web/dist
|
||||||
|
36c26,27
|
||||||
|
< FROM alpine
|
||||||
|
---
|
||||||
|
>
|
||||||
|
> FROM ${CI_REGISTRY}/alpine
|
||||||
|
38c29
|
||||||
|
< WORKDIR /app
|
||||||
|
---
|
||||||
|
> WORKDIR "/app"
|
||||||
|
45a37
|
||||||
|
> mc \
|
||||||
|
51,52c43
|
||||||
|
< COPY --from=builder /app/web/translation /app/web/translation
|
||||||
|
<
|
||||||
|
---
|
||||||
|
> ADD config/mc.tar.gz /root/.config
|
||||||
70
Dockerfile.orig
Normal file
70
Dockerfile.orig
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
# ========================================================
|
||||||
|
# Stage: Frontend (Vite)
|
||||||
|
# ========================================================
|
||||||
|
FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend
|
||||||
|
WORKDIR /src/frontend
|
||||||
|
COPY frontend/package.json frontend/package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
COPY frontend/ ./
|
||||||
|
COPY web/translation /src/web/translation
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# Stage: Builder
|
||||||
|
# ========================================================
|
||||||
|
FROM golang:1.26-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
RUN apk --no-cache --update add \
|
||||||
|
build-base \
|
||||||
|
gcc \
|
||||||
|
curl \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
COPY --from=frontend /src/web/dist ./web/dist
|
||||||
|
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
|
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
||||||
|
RUN go build -ldflags "-w -s" -o build/x-ui main.go
|
||||||
|
RUN ./DockerInit.sh "$TARGETARCH"
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# Stage: Final Image of 3x-ui
|
||||||
|
# ========================================================
|
||||||
|
FROM alpine
|
||||||
|
ENV TZ=Asia/Tehran
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apk add --no-cache --update \
|
||||||
|
ca-certificates \
|
||||||
|
tzdata \
|
||||||
|
fail2ban \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
openssl
|
||||||
|
|
||||||
|
COPY --from=builder /app/build/ /app/
|
||||||
|
COPY --from=builder /app/DockerEntrypoint.sh /app/
|
||||||
|
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
|
||||||
|
COPY --from=builder /app/web/translation /app/web/translation
|
||||||
|
|
||||||
|
|
||||||
|
# Configure fail2ban
|
||||||
|
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
|
||||||
|
&& cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local \
|
||||||
|
&& sed -i "s/^\[ssh\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
|
||||||
|
&& sed -i "s/^\[sshd\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
|
||||||
|
&& sed -i "s/#allowipv6 = auto/allowipv6 = auto/g" /etc/fail2ban/fail2ban.conf
|
||||||
|
|
||||||
|
RUN chmod +x \
|
||||||
|
/app/DockerEntrypoint.sh \
|
||||||
|
/app/x-ui \
|
||||||
|
/usr/bin/x-ui
|
||||||
|
|
||||||
|
ENV XUI_ENABLE_FAIL2BAN="true"
|
||||||
|
EXPOSE 2053
|
||||||
|
VOLUME [ "/etc/x-ui" ]
|
||||||
|
CMD [ "./x-ui" ]
|
||||||
|
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
||||||
61
Dockerfile.vados
Normal file
61
Dockerfile.vados
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
# ========================================================
|
||||||
|
# Stage: Builder
|
||||||
|
# ========================================================
|
||||||
|
ARG CI_REGISTRY=reg.vados.ru
|
||||||
|
ARG CI_BASE=${CI_REGISTRY}/golang:1.26-alpine
|
||||||
|
FROM ${CI_BASE} AS builder
|
||||||
|
WORKDIR "/app"
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
RUN apk --no-cache --update add \
|
||||||
|
build-base \
|
||||||
|
gcc \
|
||||||
|
curl \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
|
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
||||||
|
RUN go build -ldflags "-w -s" -o build/x-ui main.go
|
||||||
|
RUN ./DockerInit.sh "$TARGETARCH"
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# Stage: Final Image of 3x-ui
|
||||||
|
# ========================================================
|
||||||
|
|
||||||
|
FROM ${CI_REGISTRY}/alpine
|
||||||
|
ENV TZ=Asia/Tehran
|
||||||
|
WORKDIR "/app"
|
||||||
|
|
||||||
|
RUN apk add --no-cache --update \
|
||||||
|
ca-certificates \
|
||||||
|
tzdata \
|
||||||
|
fail2ban \
|
||||||
|
bash \
|
||||||
|
curl \
|
||||||
|
mc \
|
||||||
|
openssl
|
||||||
|
|
||||||
|
COPY --from=builder /app/build/ /app/
|
||||||
|
COPY --from=builder /app/DockerEntrypoint.sh /app/
|
||||||
|
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
|
||||||
|
ADD config/mc.tar.gz /root/.config
|
||||||
|
|
||||||
|
# Configure fail2ban
|
||||||
|
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
|
||||||
|
&& cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local \
|
||||||
|
&& sed -i "s/^\[ssh\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
|
||||||
|
&& sed -i "s/^\[sshd\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
|
||||||
|
&& sed -i "s/#allowipv6 = auto/allowipv6 = auto/g" /etc/fail2ban/fail2ban.conf
|
||||||
|
|
||||||
|
RUN chmod +x \
|
||||||
|
/app/DockerEntrypoint.sh \
|
||||||
|
/app/x-ui \
|
||||||
|
/usr/bin/x-ui
|
||||||
|
|
||||||
|
ENV XUI_ENABLE_FAIL2BAN="true"
|
||||||
|
EXPOSE 2053
|
||||||
|
VOLUME [ "/etc/x-ui" ]
|
||||||
|
CMD [ "./x-ui" ]
|
||||||
|
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
||||||
28
brun.sh
Executable file
28
brun.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
CI_REGISTRY="reg.vados.ru"
|
||||||
|
#CI_BASE="$CI_REGISTRY/golang:1.26-alpine"
|
||||||
|
#CI_FROM="$CI_REGISTRY/alpine"
|
||||||
|
#CI_PROJECT="3x-ui"
|
||||||
|
#WORKDIR="/app"
|
||||||
|
#TARGETARCH="linux/amd64"
|
||||||
|
CI_IMAGE="$CI_REGISTRY/3xui_app"
|
||||||
|
|
||||||
|
#CI_BUILD_ENGINE="buildx"
|
||||||
|
#CI_BUILDX_BUILDER="buildx_buildkit_custom_3x-ui-ci"
|
||||||
|
|
||||||
|
#CI_TAGET="--push"
|
||||||
|
#--load"
|
||||||
|
|
||||||
|
#export $CI_REGISTRY $CI_BASE $CI_FROM $CI_PROJECT $WORKDIR $TARGETARCH $CI_IMAGE $CI_BUILD_ENGINE $CI_BUILDX_BUILDER
|
||||||
|
|
||||||
|
docker build --progress=plain --no-cache --push -t $CI_IMAGE -f Dockerfile .
|
||||||
|
|
||||||
|
#docker push $CI_IMAGE
|
||||||
|
|
||||||
|
|
||||||
|
#docker buildx create --name $CI_BUILDX_BUILDER --driver docker-container --use ;
|
||||||
|
|
||||||
|
#docker buildx build --builder $CI_BUILDX_BUILDER --progress=plain --platform $CI_BUILDX_PLATFORMS \
|
||||||
|
# --build-arg CI_BASE_IMAGE=$CI_BASE_IMAGE $CI_TARGET -t $CI_IMAGE -f Dockerfile
|
||||||
12
compose-run.sh
Executable file
12
compose-run.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#--project-name=amster-registry
|
||||||
|
#docker network create -d bridge --attachable registry-ui-net
|
||||||
|
|
||||||
|
#docker compose up -d --rem
|
||||||
|
#docker compose registry-ui stop
|
||||||
|
#docker cp registry-ui:/etc/nginx/nginx.conf tmp.conf
|
||||||
|
#ls -l tmp.conf
|
||||||
|
|
||||||
|
docker-compose build --pull --no-cache
|
||||||
|
#docker-compose logs registry-ui
|
||||||
|
docker compose up -d
|
||||||
|
|
@ -10,8 +10,13 @@ services:
|
||||||
- $PWD/cert/:/root/cert/
|
- $PWD/cert/:/root/cert/
|
||||||
environment:
|
environment:
|
||||||
XRAY_VMESS_AEAD_FORCED: "false"
|
XRAY_VMESS_AEAD_FORCED: "false"
|
||||||
XUI_ENABLE_FAIL2BAN: "true"
|
XUI_ENABLE_FAIL2BAN: "false"
|
||||||
tty: true
|
tty: true
|
||||||
ports:
|
ports:
|
||||||
|
<<<<<<< HEAD
|
||||||
- "2053:2053"
|
- "2053:2053"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
=======
|
||||||
|
- "2904:2904"
|
||||||
|
restart: unless-stopped
|
||||||
|
>>>>>>> 36196363 (Edit files)
|
||||||
|
|
|
||||||
0
install.sh
Normal file → Executable file
0
install.sh
Normal file → Executable file
Loading…
Reference in a new issue