# ─────────────────────────────────────────────────────────────────────────────
# TensorFlow Autoencoder Starter — Dockerfile
# Builds a CPU-only image suitable for CI and cloud deployment.
# For GPU support: replace the base image with tensorflow/tensorflow:2.15.0-gpu
# ─────────────────────────────────────────────────────────────────────────────

FROM tensorflow/tensorflow:2.15.0 AS base

# Metadata
LABEL maintainer="DemIA Living Lab - USAL / BISITE"
LABEL description="TensorFlow Autoencoder Starter"

WORKDIR /app

# Install Python dependencies first (cached layer).
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application source.
COPY config/   config/
COPY src/      src/
COPY api/      api/
COPY app/      app/
COPY scripts/  scripts/
COPY examples/ examples/

# Directories created at runtime (checkpoints, logs).
RUN mkdir -p checkpoints logs data

# Expose API port.
EXPOSE 8000

# Default command — run training.
# Override with: docker run ... evaluate
#                docker run ... detect --input examples/sample_input.npy
#                docker run ... api
ENTRYPOINT ["python", "scripts/run.py"]
CMD ["train"]
