node / Dockerfile
bitterapricot's picture
fix check error.
5ae4842
Raw
History Blame Contribute Delete
1.28 kB
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.9
# 安装运行时依赖
RUN apt-get update && apt-get install -y \
gcc g++ cmake make git gnupg \
nginx \
supervisor \
curl \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# 安装 Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest
RUN useradd -m -u 1000 user
RUN chown -R user:user /var/lib/nginx/ \
&& chmod -R 755 /var/lib/nginx \
&& chown -R user:user /var/log/ \
&& chmod -R 755 /var/log \
&& chown -R user:user /run/ \
&& chmod -R 755 /run
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# 复制 Nginx 配置
#COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /app
RUN chmod +x /app/scripts/start.sh
# 暴露端口
EXPOSE 7860
# 启动服务
#CMD ["/app/scripts/start.sh"]
#CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
# 启动 Supervisor
CMD ["/usr/bin/supervisord", "-n", "-c", "/app/supervisor/supervisor.conf"]