0
0
MLOpsdevops~10 mins

Multi-stage builds for smaller images in MLOps - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Dockerfile line to specify the base image for the build stage.

MLOps
FROM [1] AS builder
Drag options to blanks, or click blank then click option'
Aalpine:3.18
Bubuntu:latest
Cnode:18-alpine
Dpython:3.12-slim
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a non-Python base image for a Python build stage.
2fill in blank
medium

Complete the command to copy source code into the build stage.

MLOps
COPY [1] /app/
Drag options to blanks, or click blank then click option'
A.
B./app
C./src
D/src
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent folder name in COPY command.
3fill in blank
hard

Fix the error in the command that installs dependencies in the build stage.

MLOps
RUN pip install -r [1]
Drag options to blanks, or click blank then click option'
Arequirement.txt
Brequirements.txt
Crequirements
Dreq.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Misspelling the requirements file name.
4fill in blank
hard

Fill both blanks to copy only the final app files from the build stage to the final image.

MLOps
FROM python:3.12-slim
WORKDIR /app
COPY --from=[1] [2] /app/
Drag options to blanks, or click blank then click option'
Abuilder
B/app/dist
C/app/src
Dbase
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong stage name or wrong source folder.
5fill in blank
hard

Fill all three blanks to complete the multi-stage Dockerfile that builds and runs a Python app.

MLOps
FROM [1] AS builder
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt && python setup.py build

FROM [2]
WORKDIR /app
COPY --from=[3] /app/dist /app
CMD ["python", "app.py"]
Drag options to blanks, or click blank then click option'
Apython:3.12-slim
Bpython:3.12-alpine
Cbuilder
Dubuntu:20.04
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up stage names or using incompatible base images.