One pattern I've found useful in Dockerfile lately is using [multistage 
builds](https://docs.docker.com/develop/develop-images/multistage-build) to 
encapsulate all download/unpack/cleanup in a image before the main build. This 
means if you make a cache-invalidating change early in the main build, it 
doesn't have to re-fetch the download. Something like this:

```
FROM java:8-jdk as fetchcache # Use any base here with curl, zip, tar, etc.
WORKDIR /fetch/
RUN mkdir -p nunit && cd nunit && curl -L -s -o nunit.zip 
https://github.com/nunit-legacy/nunitv2/releases/download/2.7.0/NUnit-2.7.0.zip 
&& unzip nunit.zip && rm nunit.zip
# ... Ditto for Forrest and other artifacts ...

FROM java:8-jdk as main
...
# Install mono modules
COPY --from=fetchcache /fetch/nunit /tmp/nunit
... etc
```

[ Full content available at: https://github.com/apache/avro/pull/336 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to