James Lin
James Lin

Reputation: 26528

Is it possible to insert steps before ONBUILD during docker build?

This is the base image for 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

When I extend the image using FROM kennethreitz/pipenv can I add RUN steps before the ONBUILD runs? Reason is I will need to install some packages before pipenv install

Upvotes: 2

Views: 735

Answers (1)

gCoh
gCoh

Reputation: 3089

as mentioned in https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#onbuild

A Docker build executes ONBUILD commands before any command in a child Dockerfile.

Upvotes: 2

Related Questions