3 ms·
> Must be sequestered away in a subdirectory ... Must NOT be sequestered away in a subdirectory In case you were curious/interested, docker has the ability to
by mdaniel 2y ago
> Must be sequestered away in a subdirectory ... Must NOT be sequestered away in a subdirectory
In case you were curious/interested, docker has the ability to load context from a tar stream, which I find infinitely helpful for "Dockerfile-only" builds since there's no reason to copy the current directory when there is no ADD or COPY it is going to use. Or, if it's a simple file it can still be faster
tar -cf - Dockerfile requirements.txt | docker build -t mything -
# or, to address your other point
tar -cf - docker/Dockerfile go.mod go.sum | docker build -t mything -f docker/Dockerfile -
- MereInterest 2y agoThank you, and that's probably a cleaner solution than what I've been doing. I've been making a temp directory, hard-linking each file to the appropriate location within that temp directory, then running docker from within that location. Though, either approach does have the tremendous downside of needing to maintain two entirely separate lists of the same set of files. It needs to be maintained both in the Dockerfile, and in the arguments provided to tar.