Nothing special. Just regular commit.

This commit is contained in:
Yurii Vlasov 2023-12-08 20:16:04 +02:00
parent 5ba959b0cb
commit 25d27be5d9

View file

@ -9,8 +9,8 @@ ARG TARGETOS
RUN export DEBIAN_FRONTEND=noninteractive \ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq \ && apt-get update -qq \
&& apk add --update --no-cache -qqy \ && apt-get install -qqy \
build-base \ build-essential \
gcc \ gcc \
wget \ wget \
unzip \ unzip \
@ -37,7 +37,7 @@ RUN if [ "${TARGETARCH}" = 'arm64' ]; then \
export CC=aarch64-linux-gnu-gcc; \ export CC=aarch64-linux-gnu-gcc; \
fi \ fi \
&& go build -a \ && go build -a \
-ldflags="-s -w -extldflags=-static" \ -ldflags="-s -w" \
-trimpath -o build/x-ui main.go -trimpath -o build/x-ui main.go
RUN ./DockerInit.sh "$TARGETARCH" RUN ./DockerInit.sh "$TARGETARCH"
@ -45,30 +45,33 @@ RUN ./DockerInit.sh "$TARGETARCH"
# ======================================================== # ========================================================
# Stage: Final Image of 3x-ui # Stage: Final Image of 3x-ui
# ======================================================== # ========================================================
FROM --platform=$TARGETPLATFORM alpine FROM --platform=$TARGETPLATFORM debian:bookworm
ENV TZ=Asia/Tehran
WORKDIR /app WORKDIR /app
RUN apk add --no-cache --update \ ENV TZ=Asia/Tehran
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq \
&& apt-get install -qqy \
ca-certificates \ ca-certificates \
tzdata \ tzdata \
fail2ban fail2ban \
&& apt-get clean \
&& rm -rf /var/cache/apt
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
# Configure fail2ban # Configure fail2ban
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \ RUN rm -f /etc/fail2ban/jail.d/defaults-debian.conf \
&& cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local \ && cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local \
&& sed -i "s/^\[ssh\]$/&\nenabled = false/" /etc/fail2ban/jail.local \ && sed -ri "s/^#?allowipv6\s*=.+/allowipv6 = auto/g" /etc/fail2ban/fail2ban.conf
&& sed -i "s/^\[sshd\]$/&\nenabled = false/" /etc/fail2ban/jail.local \
&& sed -i "s/#allowipv6 = auto/allowipv6 = auto/g" /etc/fail2ban/fail2ban.conf
RUN chmod 0755 \ RUN chmod 0755 \
/app/DockerEntrypoint.sh \ /app/DockerEntrypoint.sh \
/app/x-ui \ /app/x-ui \
/usr/bin/x-ui /usr/bin/x-ui
VOLUME [ "/etc/x-ui" ] VOLUME [ "/etc/x-ui" ]
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ] ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]