Answer the question
In order to leave comments, you need to log in
Docker multi-stage builds not seeing each other?
Dockerfile:
FROM php:7.4-fpm-alpine
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
FROM node:alpine
Answer the question
In order to leave comments, you need to log in
If memory serves, intermediate builds are needed to generate artifacts used in the following builds. For example, when you do not want to carry the entire builddep with you to the final container (you need already assembled software there) and produce / clean layers.
Which is better in your case - I can’t even say. I would study how containers close in components are assembled on dockerhub
If you need to put two services into one image, then the solution, unfortunately, is to write your own dockerfile. Which in structure will look like FROM of one of the two images, and then you need to copy (of course, with your head) the instructions for building the second image into a common Dockerfile. Or, in general, inherit from the base image with the operating system and manually fill it with all the necessary components (php, node, etc)
In simple cases, a variant like this works
FROM jrottenberg/ffmpeg:4.1-alpine as ffmpeg
FROM python:3.7-alpine3.8
RUN apk add --no-cache --update \
libgcc \
libstdc++ \
ca-certificates \
libcrypto1.0 \
libssl1.0 \
libgomp \
expat \
git
COPY --from=ffmpeg /usr/local /usr/local
.... a lot of stuff ....
ENTRYPOINT ["python", "capture_data.py"]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question