知识卡片
镜像构建指令声明步骤
FROM ... AS dev选择基础和阶段,WORKDIR /code设置后续工作目录,RUN执行构建命令,COPY或ADD放入文件。指令依赖与缓存影响重建,原书的浮动标签与未固定Poetry版本仍可能漂移,不是绝对可复现配方。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 依赖管理实践
原书出处 · 1 处
- · 查看原书依据
FROM python:3.10-slim-bookworm AS dev WORKDIR /code RUN apt-get update && apt-get -y install gcc RUN pip install poetry ADD pyproject.toml /code/ RUN poetry config installer.max-workers 10 ARG VENV_PATH ENV VENV_PATH=$VENV_PATH ENV PATH="$VENV_PATH/bin:$PATH" CMD ["bash"] We specify the base image that will form the base layer of our own image. The python:3.10-slim-bookworm image is 145 MB, as opposed to python:3.10, which is 915 MB. At the
参考来源
- 位置:《Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)》第04章《依赖管理实践》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Effective Machine Learning Teams (David Tan, Ada Leung, David Colls)/_epub-src/OEBPS/ch04.html)
- 结论依据:摘录中关于镜像构建指令声明步骤的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:FROM python:3.10-slim-bookworm AS dev WORKDIR /code RUN apt-get update && apt-get -y install gcc RUN pip install poetry ADD pyproject.toml /code/ RUN poetry config installer.max-workers 10 ARG VENV_PATH ENV VENV_PATH=$VENV_PATH ENV PATH="$VENV_PATH/bin:$PATH" CMD ["bash"] We specify the base image that will form the base layer of our own image. The python:3.10-slim-bookworm image is 145 MB, as opposed to python:3.10, which is 915 MB. At the