File size: 780 Bytes
4040b7e d4029d7 194e0e0 4040b7e 194e0e0 4040b7e 194e0e0 4040b7e 194e0e0 4040b7e f7cd0af 4040b7e 194e0e0 4040b7e 194e0e0 4040b7e |
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 |
# Sử dụng Python image
FROM python:3.11.5-slim-bookworm
# Tạo người dùng mới để chạy ứng dụng
RUN useradd -m -u 1000 user
USER user
# Cập nhật biến môi trường PATH
ENV PATH="/home/user/.local/bin:$PATH"
# Thiết lập thư mục làm việc
WORKDIR /app
# Copy file requirements vào container
COPY --chown=user ./requirements.txt /app/requirements.txt
# Cài đặt các package cần thiết
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
# Copy toàn bộ mã nguồn vào container
COPY --chown=user . /app
# Sao chép file cred.json vào thư mục chính xác
COPY --chown=user ./cred.json /app/config/cred.json
# Chạy ứng dụng với uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|