-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.Dockerfile
40 lines (30 loc) · 1.28 KB
/
api.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Base image
FROM python:3.12-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
wget bzip2 libgl1-mesa-glx libglib2.0-0 libxext6 libsm6 libxrender1 libxau6 libxdmcp6 graphviz && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Miniforge (multi-architecture Conda)
RUN wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh \
-O /miniforge.sh && \
bash /miniforge.sh -b -p /opt/miniforge && \
rm /miniforge.sh && \
/opt/miniforge/bin/conda clean -a
# Add Conda to PATH
ENV PATH="/opt/miniforge/bin:$PATH"
# Copy only the environment.yml file
COPY environment.yml .
# Create the Conda environment
RUN conda env create -f environment.yml && conda clean -afy
# Set the shell to use Conda environment for subsequent commands
SHELL ["conda", "run", "-n", "xai_env", "/bin/bash", "-c"]
# Set working directory
WORKDIR /app
# Copy only the required application code
COPY api /app/api
COPY xai_banking /app/xai_banking
COPY xaivision /app/xaivision
# Expose the application port
EXPOSE 8000
# Run the FastAPI application using Conda environment
CMD ["conda", "run", "--no-capture-output", "-n", "xai_env", "uvicorn", "api.src.main:app", "--host", "0.0.0.0", "--port", "8000"]