php - build image using Docker Multi-stage builds


Currently , i need to build a custom image that should contain jenkins and php 7.2 .

I have tried this shot :

FROM jenkins/jenkins:lts as jenkins

USER root

# update
RUN apt update

# dependencies
RUN apt install -qqy  \
    tzdata \
    wget \
    curl \

# Timezone
RUN echo "Europe/Paris" > /etc/timezone

FROM php:7.2-apache

WORKDIR /var/jenkins

COPY --from=build-env /app/_site ./

RUN apt-get update && apt-get install -y \
    openssl \
    git \
    unzip vim \
    libfreetype6-dev \

The second FROM (FROM php:7.2-apache) crush the whole above . And it's normal as docker behavior . Using theCopy command likeCOPY --from=jenkins /app/site ./ still blurred since there is not idea what to copy-paste .

Is there any solution to resolve that issue ?

People are also looking for solutions to the problem: php - How to build composer from a source code?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.