FROM apache/superset:latest

# เปลี่ยนเป็น root เพื่อติดตั้ง package
USER root

# ติดตั้ง PostgreSQL driver
ENV PATH="/app/.venv/bin:$PATH"

RUN python -m ensurepip --upgrade && \
/app/.venv/bin/python -m pip install --upgrade pip setuptools wheel

RUN /app/.venv/bin/pip install --no-cache-dir psycopg2-binary

# กลับมาใช้ user superset เพื่อความปลอดภัย
USER superset
