Files
Flook de7531e911
Build & Push Docker Image (Backend) / build (push) Successful in 2m8s
chore: implement self-healing entrypoint and fix line endings
2026-04-28 20:12:16 +07:00

54 lines
1.5 KiB
Docker

# =========================
# Base Image
# =========================
FROM python:3.12-slim
# =========================
# Environment Variables
# =========================
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# =========================
# System Dependencies
# =========================
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# =========================
# Working Directory
# =========================
WORKDIR /app
# =========================
# Python Dependencies
# =========================
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# =========================
# Copy Project Files
# =========================
COPY . .
# =========================
# Setup Entrypoint (เพิ่มตรงนี้ครับ)
# =========================
# แนะนำให้ใช้คำสั่งนี้เพื่อให้มั่นใจว่าสิทธิ์ไฟล์ถูกต้องใน Linux environment
RUN chmod +x /app/entrypoint.sh
# =========================
# Environment Variables (Optional)
# =========================
EXPOSE 8000
# =========================
# ENTRYPOINT & CMD # ENTRYPOINT จะรันสคริปต์เพื่อ Migrate ฐานข้อมูลก่อนเสมอ
# =========================
ENTRYPOINT ["/app/entrypoint.sh"]
# CMD จะถูกส่งไปเป็นพารามิเตอร์ $1 ให้กับ entrypoint.sh
CMD ["gunicorn"]