foo / Dockerfile
ThanaphonJoe's picture
upload all files
b419378 verified
raw
history blame contribute delete
928 Bytes
# 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"]