|
1 | 1 | # Use the official Python 3.9 image from the Docker Hub. |
2 | 2 | # This runs on Debian Linux. |
3 | | -FROM python:3.9-slim |
| 3 | +FROM --platform=linux/amd64 python:3.9 AS base |
| 4 | + |
| 5 | +############################## systempackages ################################# |
| 6 | +FROM base AS systempackages |
| 7 | + |
| 8 | +COPY requirements/base.txt base.txt |
| 9 | +COPY requirements/prod.txt requirements.txt |
| 10 | + |
| 11 | +# Install any needed packages specified in requirements.txt |
| 12 | +# Install Azure CLI and any needed packages specified in requirements.txt |
| 13 | +RUN apt-get update && \ |
| 14 | + apt-get install -y curl gnupg lsb-release && \ |
| 15 | + apt-get clean && \ |
| 16 | + rm -rf /var/lib/apt/lists/* |
| 17 | + |
| 18 | +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash |
| 19 | + |
| 20 | +# dotnet runtime installation - using official Microsoft install script |
| 21 | +RUN curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 6.0 --runtime dotnet --install-dir /usr/share/dotnet && \ |
| 22 | + ln -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet |
| 23 | + |
| 24 | +############################## python virtual environment ################################# |
| 25 | +FROM systempackages AS venv |
| 26 | + |
| 27 | +RUN pip install --upgrade pip && \ |
| 28 | + pip install --no-cache-dir -r requirements.txt |
| 29 | + |
| 30 | + |
| 31 | +############################## app ################################# |
| 32 | +FROM venv AS app |
4 | 33 |
|
5 | 34 | # Set the working directory /dist |
6 | 35 | WORKDIR /dist |
7 | 36 |
|
8 | 37 | # Copy the current directory contents into the container at /app |
9 | 38 | COPY azure_ai /dist/azure_ai |
10 | | -COPY requirements/base.txt base.txt |
11 | | -COPY requirements/prod.txt requirements.txt |
12 | 39 |
|
13 | 40 | # Set environment variables |
14 | 41 | ENV ENVIRONMENT=dev |
15 | 42 | ENV PYTHONPATH=/dist |
16 | 43 |
|
17 | | -# Install any needed packages specified in requirements.txt |
18 | | -RUN pip install --upgrade pip && \ |
19 | | - pip install --no-cache-dir -r requirements.txt |
20 | 44 |
|
21 | 45 |
|
| 46 | +################################# final ####################################### |
| 47 | +FROM app AS final |
22 | 48 | # Run the application when the container launches |
23 | | -CMD ["python", "azure_ai/automated_ml.py"] |
| 49 | +CMD ["python", "azure_ai/commands/workspace.py"] |
0 commit comments