Comments (4)
I wonder, however, if perhaps Toast doesn't actually behave in the way you'd want for your use case. Toast computes a topological sort of tasks based on their dependencies and then runs them in that order, with each task essentially inheriting the entire filesystem left over from the previous task. This might not be desirable for generating minimal production images, because there is no way to have a task that simply copies a fixed set of files from a previous task (which is the typical use case for multi-stage builds) rather than inheriting the whole filesystem (with all the build tools etc.).
So even if there were a --tag
option, I'm not sure how useful it would be!
In the past, I've considered adding functionality to Toast that would help with this. The main idea would be to allow you to specify an image on a per-task basis, rather than executing tasks all in the same conceptual filesystem. Such tasks could still have dependencies on other tasks, but they would have to explicitly copy files from their dependencies rather than just implicitly inheriting the whole filesystem. Unfortunately, this would require some more design work and would be a bigger change than just adding a way to tag the image produced by a task.
As a solution for your use case, it is possible to actually use Docker within a Toast task (more info here). So you could use Toast to define all your tasks, and then in the final build task you could actually just do docker build ... -t ...
inside the task. That way you have complete control over what ends up in your production image, and you can still use Toast to produce the artifacts that get baked into it.
Does my understanding of your situation seem right to you?
from toast.
Hi. Thanks for looking into this.
Multi-stage Dockerfiles are mostly used for creating minimal output images, but they can also be used sort of as an alternative to Makefiles. See for example the annotated Dockerfile example in this repository: https://github.com/garethr/multi-stage-build-example.
That method looks quite similar to how Toast works, but means you can reuse the Dockerfile for both ad-hoc jobs and for building the resulting output image. That's the workflow I'm envisioning using, but I would ideally build it up using Toast and a YAML file rather than having one big Dockerfile.
Does the feature request make more sense now?
from toast.
Thanks for the explanation. However, I'm still not sure whether I totally understand the use case (pardon my being dense here). From my perspective, I still think Toast is not a great fit for generating output images (at least not the images that Toast itself generates), because usually you don't want your output images to contain all your build tools and various intermediate artifacts that are typically used in Toast tasks. Toast already supports exporting files from a task, and to me that is the right way to use Toast for producing build artifacts for use in production. Alternatively, when you need the final artifact to be a Docker image, Docker can be used directly within Toast (by exposing the Docker daemon socket via Toast's mount_paths
feature) to produce tagged images. But the images that Toast generates are not ideal as output images for a few reasons:
- In a typical Toast use case, the images generated by Toast contain lots of things that you don't want in your output images (build tools, etc.).
- Toast doesn't give you complete control over the order in which tasks are run (unless you structure your dependencies in a linear chain rather than a more general DAG). It does compute topological sorts in a deterministic way, but that's probably not something to rely on. This could introduce some unpredictability in the way the output images are produced.
- Toast doesn't give you complete control over the resulting images. For example, there is no way to set the entrypoint.
So I'm essentially trying to determine if this feature request is specific to your use case and less generally applicable to everyone, or maybe there is a useful pattern here that many people would appreciate. I don't want Toast to turn into a general Docker image builder, because that direction would likely require future features that would make Toast more complicated. I am not opposed to this specific feature necessarily, but each feature comes with a maintenance burden that can complicate further development (though in this case, the maintenance burden would probably be small).
I will leave this issue open for any further discussion, and if any passers-by discover this and also want this feature, please chime in. It's totally possible that this would help a lot of people and I have misjudged the situation.
from toast.
It's wholly possible I'm the one who have an odd idea about how Toast might could fit into a setup I've got in my mind.
I suggest we close this ticket for now and then I'll come back and reopen it when I have some more concrete code where I may or may not need this feature. Thanks again for listening to me and for great explanations!
from toast.
Related Issues (20)
- podman support HOT 2
- Hidden Tasks HOT 10
- Print Task Schedule HOT 1
- toast 0.45.0 cannot print tasks HOT 2
- Support for Container Linking & Services HOT 4
- Add man page HOT 3
- Get error `Password: su: Authentication failure` when su cannot authenticate HOT 4
- Add Keywords To Project HOT 1
- Automatically disable cache when needed HOT 1
- Adding a PowerShell installation script HOT 5
- --shell causes "Unable to canonicalize the source directory. Reason: No such file or directory (os error 2)" HOT 2
- Remote execution via DOCKER_HOST incurs 50x ping latency. HOT 7
- When using remote DOCKER_HOST, cannot mount paths HOT 1
- License isn't recognized as MIT HOT 1
- Parallel task execution HOT 2
- Shared container/host download cache HOT 3
- 'toast'-bin collides with 'gsm' HOT 1
- PATH is overridden when using su HOT 3
- Adding an optional `net` or `network` corresponding to the `--network` flag in docker cli HOT 1
- Mount_paths on Windows not working properly HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toast.