| |
| FROM golang:1.26 AS builder |
|
|
| WORKDIR /src |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| git ca-certificates \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| RUN git clone --depth=1 https://github.com/router-for-me/CLIProxyAPI.git . |
|
|
| RUN go mod download |
|
|
| RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o cli-proxy-api ./cmd/server |
|
|
|
|
| |
| FROM debian:bookworm-slim |
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| ca-certificates curl bash \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| |
| RUN mkdir -p /data && chmod 777 /data |
|
|
| USER user |
|
|
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| WORKDIR $HOME/app |
|
|
| COPY --from=builder --chown=user /src/cli-proxy-api $HOME/app/cli-proxy-api |
| COPY --from=builder --chown=user /src/config.example.yaml $HOME/app/config.example.yaml |
| COPY --chown=user start.sh $HOME/app/start.sh |
|
|
| RUN chmod +x $HOME/app/cli-proxy-api $HOME/app/start.sh |
|
|
| EXPOSE 7860 |
|
|
| CMD ["./start.sh"] |