ShellCrash Docker & Self-Hosted Deployment

GitHub

Run sing-box/mihomo as client in shell

13,103 stars Shell Shell 1 file ยท ~1,551 tokens
1. Pull Image (DOCKERHUB) docker pull juewuy/ShellCrash:latest
2. Docker Run (1-Click Launch) docker run -d --name shellcrash --restart always juewuy/shellcrash:latest
3. Podman Run podman run -d --name shellcrash --restart always juewuy/shellcrash:latest
4. Skopeo Inspect (Zero-Pull Manifest) skopeo inspect docker://docker.io/juewuy/shellcrash:latest
5. ORAS Pull (OCI Artifact) oras pull juewuy/shellcrash:latest
Dockerfile
############################
# Stage 1: builder
############################
FROM alpine:latest AS builder

ARG TARGETPLATFORM
ARG TZ=Asia/Shanghai
ARG S6_OVERLAY_V=v3.2.1.0

RUN apk add --no-cache curl tzdata

# ๆ—ถๅŒบ
RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
    echo "${TZ}" > /etc/timezone

WORKDIR /build

#ๅฎ‰่ฃ…่„šๆœฌ็›ธๅ…ณๆ–‡ไปถ
COPY ShellCrash.tar.gz /tmp/ShellCrash.tar.gz
RUN set -eux; \
    mkdir -p /tmp/SC_tmp; \
    tar -zxf /tmp/ShellCrash.tar.gz -C /tmp/SC_tmp; \
    export systype=container; \
    export CRASHDIR=/etc/ShellCrash; \
    /bin/sh /tmp/SC_tmp/init.sh
	
#่Žทๅ–ๅ†…ๆ ธๅŠs6ๆ–‡ไปถ
RUN set -eux; \
	case "$TARGETPLATFORM" in \
      linux/amd64)  K=amd64 S=x86_64;; \
      linux/arm64)  K=arm64 S=aarch64;; \
      linux/arm/v7) K=armv7 S=arm;; \
      linux/386)    K=386 S=i486;; \
      *) echo "unsupported $TARGETPLATFORM" && exit 1 ;; \
    esac; \
    curl -fsSL "https://github.com/juewuy/ShellCrash/raw/update/bin/meta/clash-linux-${K}.tar.gz" -o /tmp/CrashCore.tar.gz; \
    curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_V}/s6-overlay-${S}.tar.xz" -o /tmp/s6_arch.tar.xz; \
    curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_V}/s6-overlay-noarch.tar.xz" -o /tmp/s6_noarch.tar.xz && ls -l /tmp

#ๅฎ‰่ฃ…้ขๆฟๆ–‡ไปถ
RUN set -eux; \
    mkdir -p /etc/ShellCrash/ruleset /etc/ShellCrash/ui; \
    curl -fsSL "https://github.com/juewuy/ShellCrash/raw/update/bin/geodata/mrs.tar.gz" | tar -zxf - -C /etc/ShellCrash/ruleset; \
    curl -fsSL "https://github.com/juewuy/ShellCrash/raw/update/bin/dashboard/zashboard.tar.gz" | tar -zxf - -C /etc/ShellCrash/ui
	  
############################
# Stage 2: runtime
############################
FROM alpine:latest

ARG TZ=Asia/Shanghai

LABEL org.opencontainers.image.source="https://github.com/juewuy/ShellCrash"
#ๅฎ‰่ฃ…ไพ่ต–
RUN apk add --no-cache \
    wget \
    ca-certificates \
    tzdata \
    nftables \
    iproute2

RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
    echo "${TZ}" > /etc/timezone

#ๅคๅˆถๆ–‡ไปถ
COPY --from=builder /etc/ShellCrash /etc/ShellCrash
COPY --from=builder /tmp/CrashCore.tar.gz /etc/ShellCrash/CrashCore.tar.gz
COPY --from=builder /etc/profile /etc/profile
COPY --from=builder /usr/bin/crash /usr/bin/crash

#ๅฎ‰่ฃ…s6
COPY --from=builder /tmp/s6_arch.tar.xz /tmp/s6_arch.tar.xz
COPY --from=builder /tmp/s6_noarch.tar.xz /tmp/s6_noarch.tar.xz
RUN tar -xJf /tmp/s6_noarch.tar.xz -C / && rm -rf /tmp/s6_noarch.tar.xz
RUN tar -xJf /tmp/s6_arch.tar.xz -C / && rm -rf /tmp/s6_arch.tar.xz
COPY docker/s6-rc.d /etc/s6-overlay/s6-rc.d
COPY docker/s6-overlay/scripts/sync-autostart /etc/s6-overlay/scripts/sync-autostart
RUN chmod +x /etc/s6-overlay/scripts/sync-autostart
ENV S6_CMD_WAIT_FOR_SERVICES=1
ENV S6_STAGE2_HOOK=/etc/s6-overlay/scripts/sync-autostart

ENTRYPOINT ["/init"]