deepseek-free-api / Dockerfile
aigenai's picture
Update Dockerfile
42508ee verified
raw
history blame
2.32 kB
# 使用 PostgreSQL 作为基础镜像
FROM nikolaik/python-nodejs:python3.12-nodejs20
# 添加维护者信息
LABEL maintainer="ai来事 <交流群:https://qr61.cn/oohivs/qRp62U6>"
ARG CACHEBUST=1
# 设置构建参数,提供默认值
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/deepseek-free-api
# 复制启动脚本并创建数据目录
RUN cd /home/pn && git clone https://github.com/aigem/deepseek-free-api.git \
&& cd deepseek-free-api && npm i && npm run build && chown -R pn:pn /home/pn/deepseek-free-api
# 复制run.sh脚本到容器中
COPY run.sh /home/pn/deepseek-free-api/
# 复制ksa配置文件和可执行文件
COPY ksa.conf /home/pn/deepseek-free-api/
COPY ksa_x64 /home/pn/deepseek-free-api/
# 添加执行权限
RUN chmod +x /home/pn/deepseek-free-api/run.sh \
&& chmod +x /home/pn/deepseek-free-api/ksa_x64
# 暴露端口
EXPOSE 8000
# 切换到非 root 用户
USER pn
# 启动命令
CMD ["./run.sh"]