Spaces:
Sleeping
Sleeping
File size: 912 Bytes
931bd01 69ddcdf 931bd01 6ec79ba 931bd01 34a1631 931bd01 ffa1ff4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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"]
|