# Use the official Python slim image
FROM python:3.12-slim-bullseye
# Set working directory
WORKDIR /app
# Copy the current directory contents into the container
COPY . /app
# Install necessary packages
RUN apt-get update && apt-get install -y \
git \
gcc \
python3-dev \
libffi-dev \
musl-dev \
make \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip and install dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install --upgrade langchain-google-genai
# Define build arguments for secrets
ARG AWS_ACCESS_KEY
ARG AWS_SECRET_KEY
ARG GEMINI_API_KEY
ARG IP
# Set environment variables for the application using the build arguments
ENV AWS_ACCESS_KEY=$AWS_ACCESS_KEY
ENV AWS_SECRET_KEY=$AWS_SECRET_KEY
ENV GEMINI_API_KEY=$GEMINI_API_KEY
ENV IP=$IP
# Expose the necessary port
EXPOSE 80
# Start the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]