这是pipenv的基本图像:
FROM ubuntu:18.04
# -- Install Pipenv:
RUN apt update && apt install python3-pip git -y && pip3 install pipenv
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
# -- Install Application into container:
RUN set -ex && mkdir /app
WORKDIR /app
# -- Adding Pipfiles
ONBUILD COPY Pipfile Pipfile
ONBUILD COPY Pipfile.lock Pipfile.lock
# -- Install dependencies:
ONBUILD RUN set -ex && pipenv install --deploy --system
# --------------------
# - Using This File: -
# --------------------
# FROM kennethreitz/pipenv
# COPY . /app
# -- Replace with the correct path to your app's main executable
# CMD python3 main.py
使用FROM kennethreitz/pipenv
扩展图像时,是否可以在运行ONBUILD之前添加RUN
个步骤?原因是我需要在pipenv install
答案 0 :(得分:1)
如https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#onbuild
中所述Docker构建在子Dockerfile中的任何命令之前执行ONBUILD命令。