Spaces:
Runtime error
Runtime error
Peiiiiiiiiru
commited on
Commit
•
9044537
1
Parent(s):
4445929
Create Dockerfile
Browse files- Dockerfile +19 -0
Dockerfile
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
# 創建非 root 使用者
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
+
USER user
|
6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
7 |
+
|
8 |
+
# 設置工作目錄
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# 複製依賴並安裝
|
12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
+
|
15 |
+
# 複製應用程式檔案
|
16 |
+
COPY --chown=user . /app
|
17 |
+
|
18 |
+
# 執行 Flask 應用程式
|
19 |
+
CMD ["python", "app.py"]
|