FROM python:3.12-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    nginx supervisor && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Python deps
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# App code
COPY server /app/server
COPY client /app/client
COPY server/assets /app/server/assets

# Nginx & Supervisor configs
COPY deploy/nginx.conf /etc/nginx/nginx.conf
COPY deploy/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN mkdir -p /var/run/nginx /app/server/instance

ENV TZ=Europe/Bucharest \
    API_BIND=127.0.0.1:5000 \
    FLET_BIND=127.0.0.1:8080 \
    API_BASE_PATH=/api

EXPOSE 80

# (You said we can omit the healthcheck for now)
CMD ["/usr/bin/supervisord","-c","/etc/supervisor/conf.d/supervisord.conf"]