Rename docker-compose.yml to Dockerfile
Browse files- Dockerfile +56 -0
- docker-compose.yml +0 -16
Dockerfile
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ========================================================
|
2 |
+
# Stage: Builder
|
3 |
+
# ========================================================
|
4 |
+
FROM golang:1.23-alpine AS builder
|
5 |
+
WORKDIR /app
|
6 |
+
ARG TARGETARCH
|
7 |
+
|
8 |
+
RUN git clone https://github.com/MHSanaei/3x-ui.git
|
9 |
+
RUN cd 3x-ui
|
10 |
+
|
11 |
+
RUN apk --no-cache --update add \
|
12 |
+
build-base \
|
13 |
+
gcc \
|
14 |
+
wget \
|
15 |
+
unzip
|
16 |
+
|
17 |
+
COPY . .
|
18 |
+
|
19 |
+
ENV CGO_ENABLED=1
|
20 |
+
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
21 |
+
RUN go build -o build/x-ui main.go
|
22 |
+
RUN ./DockerInit.sh "$TARGETARCH"
|
23 |
+
|
24 |
+
# ========================================================
|
25 |
+
# Stage: Final Image of 3x-ui
|
26 |
+
# ========================================================
|
27 |
+
FROM alpine
|
28 |
+
ENV TZ=Asia/Tehran
|
29 |
+
WORKDIR /app
|
30 |
+
|
31 |
+
RUN apk add --no-cache --update \
|
32 |
+
ca-certificates \
|
33 |
+
tzdata \
|
34 |
+
fail2ban \
|
35 |
+
bash
|
36 |
+
|
37 |
+
COPY --from=builder /app/build/ /app/
|
38 |
+
COPY --from=builder /app/DockerEntrypoint.sh /app/
|
39 |
+
COPY --from=builder /app/x-ui.sh /usr/bin/x-ui
|
40 |
+
|
41 |
+
|
42 |
+
# Configure fail2ban
|
43 |
+
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
|
44 |
+
&& cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local \
|
45 |
+
&& sed -i "s/^\[ssh\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
|
46 |
+
&& sed -i "s/^\[sshd\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
|
47 |
+
&& sed -i "s/#allowipv6 = auto/allowipv6 = auto/g" /etc/fail2ban/fail2ban.conf
|
48 |
+
|
49 |
+
RUN chmod +x \
|
50 |
+
/app/DockerEntrypoint.sh \
|
51 |
+
/app/x-ui \
|
52 |
+
/usr/bin/x-ui
|
53 |
+
|
54 |
+
VOLUME [ "/etc/x-ui" ]
|
55 |
+
CMD [ "./x-ui" ]
|
56 |
+
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
docker-compose.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
---
|
2 |
-
version: "3"
|
3 |
-
|
4 |
-
services:
|
5 |
-
3x-ui:
|
6 |
-
image: ghcr.io/mhsanaei/3x-ui:latest
|
7 |
-
container_name: 3x-ui
|
8 |
-
hostname: yourhostname
|
9 |
-
volumes:
|
10 |
-
- $PWD/db/:/etc/x-ui/
|
11 |
-
- $PWD/cert/:/root/cert/
|
12 |
-
environment:
|
13 |
-
XRAY_VMESS_AEAD_FORCED: "false"
|
14 |
-
tty: true
|
15 |
-
network_mode: host
|
16 |
-
restart: unless-stopped
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|