| FROM golang:1.26-alpine AS builder |
|
|
| ARG CLIPROXY_REPO=https://github.com/xiubia/CLIProxyAPI.git |
| ARG CLIPROXY_REF=main |
|
|
| RUN apk add --no-cache bash ca-certificates git |
|
|
| WORKDIR /src |
|
|
| RUN git clone --depth 1 --branch "${CLIPROXY_REF}" "${CLIPROXY_REPO}" CLIProxyAPI |
|
|
| WORKDIR /src/CLIProxyAPI |
|
|
| RUN go build -o /out/cli-proxy-api ./cmd/server |
|
|
| FROM alpine:3.22 |
|
|
| USER root |
|
|
| |
| RUN apk add --no-cache bash ca-certificates libc6-compat gcompat |
|
|
| WORKDIR /app |
|
|
| |
| COPY --from=builder /out/cli-proxy-api ./cli-proxy-api |
| RUN chmod +x ./cli-proxy-api |
|
|
| |
| RUN mkdir -p /tmp/.cli-proxy-api /tmp/logs /tmp/pg_cache/pgstore \ |
| && chmod -R 777 /tmp |
|
|
| |
| COPY config.yaml /app/config.yaml |
|
|
| |
| RUN cp /app/config.yaml /app/config.example.yaml |
|
|
| ENV TZ=Asia/Shanghai |
| EXPOSE 7860 |
|
|
| |
| CMD ["./cli-proxy-api", "--config", "/app/config.yaml"] |
|
|