fix: minimal fix for Dockerfile and force docker compose use local Dockerfile

This commit is contained in:
Philip Mantrov 2024-12-05 13:16:47 +03:00
parent 4efcdb3e01
commit 8be198ce5d
2 changed files with 12 additions and 6 deletions

View file

@ -9,7 +9,8 @@ RUN apk --no-cache --update add \
build-base \ build-base \
gcc \ gcc \
wget \ wget \
unzip unzip \
dos2unix
COPY . . COPY . .
@ -18,6 +19,9 @@ ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
RUN go build -o build/x-ui main.go RUN go build -o build/x-ui main.go
RUN ./DockerInit.sh "$TARGETARCH" RUN ./DockerInit.sh "$TARGETARCH"
RUN dos2unix /app/DockerEntrypoint.sh
RUN dos2unix /app/x-ui.sh
# ======================================================== # ========================================================
# Stage: Final Image of 3x-ui # Stage: Final Image of 3x-ui
# ======================================================== # ========================================================
@ -29,12 +33,12 @@ RUN apk add --no-cache --update \
ca-certificates \ ca-certificates \
tzdata \ tzdata \
fail2ban \ fail2ban \
bash bash \
curl
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/local/x-ui/x-ui
# Configure fail2ban # Configure fail2ban
RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \ RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
@ -46,7 +50,7 @@ RUN rm -f /etc/fail2ban/jail.d/alpine-ssh.conf \
RUN chmod +x \ RUN chmod +x \
/app/DockerEntrypoint.sh \ /app/DockerEntrypoint.sh \
/app/x-ui \ /app/x-ui \
/usr/bin/x-ui /usr/local/x-ui/x-ui
VOLUME [ "/etc/x-ui" ] VOLUME [ "/etc/x-ui" ]
CMD [ "./x-ui" ] CMD [ "./x-ui" ]

View file

@ -3,7 +3,9 @@ version: "3"
services: services:
3x-ui: 3x-ui:
image: ghcr.io/mhsanaei/3x-ui:latest build:
context: .
dockerfile: ./Dockerfile
container_name: 3x-ui container_name: 3x-ui
hostname: yourhostname hostname: yourhostname
volumes: volumes: