FROM    086679231553.dkr.ecr.us-east-1.amazonaws.com/docker-parent-images:python312 AS base

USER    root
WORKDIR /app

ARG SNOWFLAKE_PRIVATE_KEY_RAW
ARG SNOWFLAKE_SCHEMA
ARG AUTH0_CREDS

COPY requirements.txt .
COPY streamlit_app ./streamlit_app

RUN echo "ouath_secret ='" $AUTH0_CREDS "'" >> ./streamlit_app/secrets.toml

RUN pip install --upgrade pip && \
    pip install setuptools wheel && \
    pip install -r requirements.txt

ENV PATH="/var/app/.venv/bin:${PATH}"
ENV PATH="/home/worker/.local/bin:${PATH}"

WORKDIR /app/streamlit_app

RUN snow --config-file=config.toml connection test --connection my_connection

RUN snow --config-file=config.toml streamlit deploy --connection my_connection --replace
