Skip to content

Commit 0706594

Browse files
committed
chore: update and optimize Dockerfile by adding layers
1 parent 657bb69 commit 0706594

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

Dockerfile

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,49 @@
11
# Use the official Python 3.9 image from the Docker Hub.
22
# 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
433

534
# Set the working directory /dist
635
WORKDIR /dist
736

837
# Copy the current directory contents into the container at /app
938
COPY azure_ai /dist/azure_ai
10-
COPY requirements/base.txt base.txt
11-
COPY requirements/prod.txt requirements.txt
1239

1340
# Set environment variables
1441
ENV ENVIRONMENT=dev
1542
ENV PYTHONPATH=/dist
1643

17-
# Install any needed packages specified in requirements.txt
18-
RUN pip install --upgrade pip && \
19-
pip install --no-cache-dir -r requirements.txt
2044

2145

46+
################################# final #######################################
47+
FROM app AS final
2248
# 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

Comments
 (0)