mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
adds Dockerfile
This commit is contained in:
parent
4fb060d25e
commit
c20c4d63ce
2 changed files with 40 additions and 0 deletions
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.github
|
||||||
|
docker-compose.yaml
|
||||||
|
Dockerfile
|
||||||
|
install.sh
|
||||||
|
x-ui.sh
|
||||||
|
x-ui.service
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# ARG XRAY_VERSION=1.8.0
|
||||||
|
|
||||||
|
# Build stage
|
||||||
|
FROM golang:1.20.3-alpine3.17 AS build
|
||||||
|
WORKDIR /app
|
||||||
|
RUN apk update && apk add --no-cache --update gcc build-base
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=1 go build main.go
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM alpine:3.17.3
|
||||||
|
# ARG XRAY_VERSION
|
||||||
|
ENV TZ=Asia/Tehran
|
||||||
|
WORKDIR /app
|
||||||
|
# RUN useradd -D -g '' xui
|
||||||
|
RUN apk update && apk add --no-cache --update ca-certificates tzdata && update-ca-certificates
|
||||||
|
|
||||||
|
# Download xray-core binary and install it to /app/bin
|
||||||
|
# ADD https://github.com/XTLS/Xray-core/releases/download/v${XRAY_VERSION}/Xray-linux-64.zip /tmp/xray.zip
|
||||||
|
ADD https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip /tmp/xray.zip
|
||||||
|
RUN unzip /tmp/xray.zip -d bin && rm /tmp/xray.zip && mv bin/xray bin/xray-linux-amd64
|
||||||
|
|
||||||
|
# Download latest rule files
|
||||||
|
ADD https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat \
|
||||||
|
https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \
|
||||||
|
https://github.com/bootmortis/iran-hosted-domains/releases/latest/download/iran.dat \
|
||||||
|
bin/
|
||||||
|
COPY --from=build /app/main /app/x-ui
|
||||||
|
VOLUME [ "/etc/x-ui" ]
|
||||||
|
# USER xui
|
||||||
|
ENTRYPOINT ["/bin/sh", "-c", "ln -sf /proc/1/fd/1 /app/access.log; /app/x-ui"]
|
||||||
|
# CMD [ "/app/x-ui" ]
|
Loading…
Reference in a new issue