-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·36 lines (27 loc) · 1.01 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·36 lines (27 loc) · 1.01 KB
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
# Use an official Python runtime as a parent image
FROM python:3.9-slim-bullseye
# Set the working directory in the container
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install dependencies, build, and cleanup in one layer
RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg p7zip-full build-essential libssl-dev && \
pip install --no-cache-dir -r requirements.txt && \
apt-get purge -y --auto-remove build-essential libssl-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy the rest of the application
COPY . .
# 關鍵修正:確保必要的資料夾存在,即使 Git 沒有傳送它們
RUN mkdir -p logs cache temp_uploads instance && \
chmod -R 777 logs cache temp_uploads instance
# Make the entrypoint script executable
RUN chmod +x run.sh
# Hugging Face 固定使用 7860
EXPOSE 7860
# Define environment variables for Flask
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
# Run the application
CMD ["./run.sh"]