| FROM golang:1.22-alpine AS builder |
|
|
| WORKDIR /build/ws-proxy |
| COPY ws-proxy/ . |
| RUN go mod tidy |
| RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /out/ws-proxy-linux-amd64 . |
| RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o /out/ws-proxy-linux-arm64 . |
| RUN CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o /out/ws-proxy-darwin-amd64 . |
| RUN CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o /out/ws-proxy-darwin-arm64 . |
|
|
| WORKDIR /build/ws-bridge |
| COPY ws-bridge/ . |
| RUN go mod tidy |
| RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/ws-bridge . |
|
|
| FROM archlinux:latest |
|
|
| RUN pacman -Syu --noconfirm openssh git && \ |
| pacman -Scc --noconfirm |
|
|
| RUN mkdir -p /run/sshd && \ |
| sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config && \ |
| sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \ |
| sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config |
|
|
| WORKDIR /root |
|
|
| COPY --from=builder /out/ws-proxy-* /opt/binaries/ |
| COPY --from=builder /out/ws-bridge /opt/ws-bridge |
| COPY entrypoint.sh /opt/entrypoint.sh |
| RUN chmod +x /opt/entrypoint.sh |
|
|
| EXPOSE 7860 |
|
|
| ENTRYPOINT ["/opt/entrypoint.sh"] |
|
|