NIH-NCPI / hl7-fhir-ig-publisher

🐳 Dockerized FHIR IG Publisher
https://hub.docker.com/repository/docker/kidsfirstdrc/fhir-ig-publisher
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Cache HL7 IG packages in IG publisher docker image #29

Open znatty22 opened 4 years ago

znatty22 commented 4 years ago

We need to eliminate the need for the IG publisher to download HL7 packages from the package server by caching the packages inside the publisher docker image. This is beneficial because it shields us from breakages on the package server or inside the packages themselves.

Each time we update the IG publisher docker image in this repo, we should update the HL7 packages. This should be fairly easy to do using a shell script to build the IG publisher docker image. The script would do the following:

1. Build docker image
2. Run docker image as a container to build the test IG and build the package cache
3. Snapshot (e.g. `docker container commit`) the docker container after the test IG is built in order to create a new docker image with all of the HL7 packages
brianpos commented 4 years ago

This was pretty simple to do both these activities in the docker run arguments, provide the package cache location... -v "$(USERPROFILE)/.fhir:/root/.fhir" (in my testing I was explicitly using the value of that folder, not using the env var)

znatty22 commented 4 years ago

Hey @brianpos yep that works if you're running the docker container on a machine where the cache already exists. This issue is more for addressing the problem in a CI environment.

In most CI environments, each CI run creates a fresh CI environment without relying on any cached data or code dependencies. If we had the HL7 packages cached inside the IG publisher docker image then the IG publisher container can be run on a machine with no previous FHIR package cache. Users like yourself would still be able to override the package cache by bind mounting your cache into the container as volume, as you pointed out above.

brianpos commented 4 years ago

If the env is being recreated, then the docker image is also being downloaded, so not sure how much you'd be gaining. I guess you could have a disk you mount with the image too. Issue would be what packages you depend on, there's always going to be different ones. Personally I need the R4 base ones, and 2 AU base sets too. So really only saving me 1 package. And US users would want us-core, but I don't...

I have a new docker image based on this project too, as the IG publisher source has moved again... And almost have it in use for my CI in Azure devops. (removing the need for on in prem agent) And also working in some more publishing docker tools too.

brianpos commented 4 years ago

@znatty22 you should update the location of the IG publisher jar as that has changed again... You can grab the new location from my version of this: https://github.com/brianpos/FHIR-IG-Builder-Assistant/tree/docker/hl7-fhir-ig-publisher-docker