File size: 928 Bytes
3562abc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# 1. ใช้ base image ของ Python 3.9
FROM python:3.9-slim

# 2. ตั้งค่า working directory ใน container
WORKDIR /code

# 3. คัดลอกไฟล์ requirements.txt เข้าไปก่อน
COPY ./requirements.txt /code/requirements.txt

# 4. ติดตั้ง dependencies จากไฟล์ requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# 5. คัดลอกไฟล์โค้ดและโมเดลทั้งหมดเข้าไป
COPY . /code/

# 6. บอกให้ Container เปิด Port 80 รอรับการเชื่อมต่อ
EXPOSE 80

# 7. คำสั่งสำหรับรันแอปพลิเคชันของเรา  ใช้ PORT  7860  ซึ่งเป็น defaul port ของ Hugging face Space
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]