WebNov 1, 2024 · Then you can build one stage or another using the --target syntax to build, or a compose file like: # docker-compose.yml version: '3.4' services: webapp: build: context: ./dir dockerfile: Dockerfile target: prod. The biggest downside is the current build engine will go through every stage until it reaches the target. WebDec 18, 2024 · You only need to run the command once (i.e., docker-compose -f docker-compose.yml -f docker-compose.prod.yml up --build ). What you're doing currently is running Docker Compose twice, once with only docker-compose.prod.yml and then again with only docker-compose.yml. – Neel Kamath Dec 18, 2024 at 13:17 Add a comment …
multi-stage build in docker compose? - Stack Overflow
WebJul 23, 2024 · what do you mean when you say “multiple Dockerfiles”? The normal case is that you have one Dockerfile for each image you want to build. If it is a complex structure of images that needs to be built, I use a common root project with one or more docker-compose.yml that has references to sub directories, one for each image needed. Web26 rows · When you supply multiple files, Compose combines them into a single configuration. Compose builds the configuration in the order you supply the files. … flowserve 520md+ positioner
How to prevent docker-compose building the same image multiple …
WebApr 23, 2015 · The docs seem to suggest to place different Dockerfiles in different directories, but I'd like them all to be in the same one (and perhaps distinguishable using the following convention: Dockerfile.postgres, Dockerfile.main...). Is this possible? Edit: The … WebFeb 28, 2024 · The docker-compose.*.yml files are definition files and can be used by multiple infrastructures that understand that format. The most straightforward tool is the … WebDec 13, 2024 · Not exactly OP's scenario, but if you're not using docker-compose, you can also specify context and Dockerfile separately: docker build . -f app/dockerfiles/webserver/Dockerfile This builds with the current directory . as the context, but uses the Dockerfile from the subdirectory. Share Improve this answer Follow … green coffee filters