Update Dockerfile
Browse files- Dockerfile +23 -7
Dockerfile
CHANGED
|
@@ -1,18 +1,34 @@
|
|
| 1 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
# you will also find guides on how best to write your Dockerfile
|
| 3 |
|
| 4 |
-
FROM nginx
|
| 5 |
|
| 6 |
# The two following lines are requirements for the Dev Mode to be functional
|
| 7 |
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
| 8 |
-
RUN useradd -m -u 1000 user
|
| 9 |
-
WORKDIR /app
|
| 10 |
-
RUN mkdir -p /var/cache/nginx/client_temp && \
|
| 11 |
-
chown -R nginx:nginx /var/cache/nginx
|
| 12 |
|
| 13 |
-
COPY --chown=user ./requirements.txt requirements.txt
|
| 14 |
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 15 |
|
| 16 |
-
COPY --chown=user . /app
|
| 17 |
#CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
# you will also find guides on how best to write your Dockerfile
|
| 3 |
|
| 4 |
+
#FROM nginx
|
| 5 |
|
| 6 |
# The two following lines are requirements for the Dev Mode to be functional
|
| 7 |
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
|
| 8 |
+
#RUN useradd -m -u 1000 user
|
| 9 |
+
#WORKDIR /app
|
| 10 |
+
#RUN mkdir -p /var/cache/nginx/client_temp && \
|
| 11 |
+
# chown -R nginx:nginx /var/cache/nginx
|
| 12 |
|
| 13 |
+
#COPY --chown=user ./requirements.txt requirements.txt
|
| 14 |
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 15 |
|
| 16 |
+
#COPY --chown=user . /app
|
| 17 |
#CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 18 |
|
| 19 |
+
FROM nginx:alpine
|
| 20 |
+
|
| 21 |
+
# 创建必要的目录并设置权限
|
| 22 |
+
RUN mkdir -p /var/cache/nginx/client_temp && \
|
| 23 |
+
mkdir -p /var/cache/nginx/proxy_temp && \
|
| 24 |
+
chown -R root:root /var/cache/nginx
|
| 25 |
+
|
| 26 |
+
# 复制 Nginx 配置文件
|
| 27 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 28 |
+
|
| 29 |
+
# 以 root 用户运行 Nginx
|
| 30 |
+
USER root
|
| 31 |
+
|
| 32 |
+
# 启动 Nginx
|
| 33 |
+
CMD ["nginx", "-g", "daemon off;"]
|
| 34 |
+
|