signal-tracker / Dockerfile
vumichien's picture
Upload Flask app
a11f31d
raw
history blame
891 Bytes
# Sử dụng một image chính thức của Python 3
FROM python:3.9-slim
# Thiết lập biến môi trường để Python không tạo các file pyc
ENV PYTHONDONTWRITEBYTECODE=1
# Thiết lập biến môi trường để Python không buffer output
ENV PYTHONUNBUFFERED=1
# Tạo và đặt thư mục làm việc cho ứng dụng Flask
WORKDIR /app
# Tạo thư mục instance với quyền truy cập phù hợp
RUN mkdir -p /app/instance && chmod -R 755 /app/instance
# Sao chép file requirements.txt vào container
COPY requirements.txt /app/
# Cài đặt các dependencies từ requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Sao chép toàn bộ mã nguồn ứng dụng vào container
COPY . /app/
# Expose port 5000 for Flask
EXPOSE 5000
# Chạy ứng dụng Flask bằng Gunicorn
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:app"]