Spaces:
Sleeping
Sleeping
# FROM ghcr.io/aurora-develop/duck2api:latest | |
# https://raw.githubusercontent.com/aurora-develop/Duck2api/main/Dockerfile | |
# 使用 Go 1.21 官方镜像作为构建环境 | |
FROM golang:1.21 AS builder | |
# 禁用 CGO | |
ENV CGO_ENABLED=0 | |
# 设置工作目录 | |
WORKDIR /app | |
# 复制 go.mod 和 go.sum 并下载依赖 | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
# 复制源代码并构建应用 | |
COPY . . | |
RUN go build -ldflags "-s -w" -o /app/duck2api . | |
# 使用 Alpine Linux 作为最终镜像 | |
# FROM alpine:latest | |
FROM python:3.11 | |
# 设置工作目录 | |
WORKDIR /app | |
# 从构建阶段复制编译好的应用和资源 | |
COPY --from=builder /app/duck2api /app/duck2api | |
ENV PIP_ROOT_USER_ACTION=ignore | |
COPY . . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# add prefix /hf route and flask forwarder | |
# 暴露端口 | |
# EXPOSE 8080 | |
# EXPOSE 5000 | |
EXPOSE 18080 | |
# CMD ["/app/duck2api"] | |
CMD ["python", "duck2api_fwd.py"] | |