Spaces:
Running
Running
File size: 1,930 Bytes
ddf1b87 816d6fd ddf1b87 |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# 使用 PostgreSQL 作为基础镜像
FROM nikolaik/python-nodejs:python3.12-nodejs20
# 添加维护者信息
LABEL maintainer="ai来事 <交流群:https://qr61.cn/oohivs/qRp62U6>"
ARG CACHEBUST=2
# 设置构建参数,提供默认值
ARG WEBHOOK_URL=https://你的hf账户名-空间名.hf.space/
# 设置基本环境变量
ENV WEBHOOK_URL=${WEBHOOK_URL}
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
gnupg \
build-essential \
sudo \
vim \
git \
procps \
lsof \
net-tools \
ca-certificates \
openssl \
tzdata \
htop \
jq \
netcat-openbsd \
redis-server \
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
# 清理
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# # 创建环境变量文件
# RUN --mount=type=secret,id=POSTGRES_USER,mode=0444,required=true \
# --mount=type=secret,id=POSTGRES_PASSWORD,mode=0444,required=true \
# --mount=type=secret,id=POSTGRES_DB,mode=0444,required=true \
# --mount=type=secret,id=POSTGRESDB_HOST,mode=0444,required=true \
# echo "export DB_POSTGRESDB_HOST=$(cat /run/secrets/POSTGRESDB_HOST)" >> /home/pn/.env && \
# echo "export DB_POSTGRESDB_USER=$(cat /run/secrets/POSTGRES_USER)" >> /home/pn/.env && \
# echo "export DB_POSTGRESDB_PASSWORD=$(cat /run/secrets/POSTGRES_PASSWORD)" >> /home/pn/.env && \
# echo "export DB_POSTGRESDB_DATABASE=$(cat /run/secrets/POSTGRES_DB)" >> /home/pn/.env && \
# chown pn:pn /home/pn/.env
# 创建工作目录
WORKDIR /home/pn
# 复制启动脚本并创建数据目录
RUN cd /home/pn && git clone https://github.com/aigem/deepseek-free-api.git \
&& cd deepseek-free-api && npm i && npm run build
# 暴露端口
EXPOSE 8000
# 切换到非 root 用户
USER pn
# 启动命令
CMD ["./run.sh"]
|