DigitalHealthIntegration / rdt-reader

MIT License
2 stars 0 forks source link

Dockerfile should handle all aspects of image building #11

Closed rightparen closed 4 years ago

rightparen commented 4 years ago

This image will be deployed to Fargate, which is a container runtime in AWS where we do not have the ability to post-process the container image. Standard practice is to generate a Docker image that is self-sufficient and complete.

Currently, the documentation at https://github.com/DigitalHealthIntegration/rdt-reader/wiki/Setup-of-rdt-server-on-docker specifies running Docker on a particular kind of machine and doing steps after building the image. Steps 5-8 should be integrated into the Dockerfile.

Also, when I created the DockerBuild script, I made a mistake. The workaround was incorrect in two ways: 1) Putting the models in the correct place should be done inside the Dockerfile rather than outside in a script. I.e. there should be a RUN step after the COPY step that handles this fixup. 2) Doing this inside the Dockerfile means we can do a mv rather than an rsync. That way we avoid doubling the size of the container image.

Once both of these are addressed, there should no longer be a need for the DockerBuild script. The instructions can then just be 3 steps: "(1) Build an image from Dockerfile, (2) verify it is correct by ..., (3) deploy the image."

anandRIyer commented 4 years ago

Hi Mike, I am running some initial tests on my local docker instance to generate a single docker image which can do the above steps (steps 5-8) at startup itself. I will also try to test this on a fargate container and let you know.

The goal is with the docker image created, we should be able to do: docker run image and get going.

rightparen commented 4 years ago

@anandRIyer that's fine. Even better though would be to run most of those steps as part of building the image. Certainly you could create/run database migrations as part of the image so the database is just ready to go. Then startup can just start the service.

anandRIyer commented 4 years ago

I fixed this issue. Once done this is what I did to run the rdt setup on docker:

  1. go to the rdt-reader git folder.
  2. sudo ./DockerBuild (this builds the docker image)
  3. Once done, you should see the image by running: docker images.
  4. sudo docker run --net=host -d -p 9000:9000 iprd-rdt-reader:latest (--net=host is required to ensure we can access the container ip/port from the docker host)
anandRIyer commented 4 years ago

Please let me know if there are any more issues that need to be addressed here. If not, I'll close this out

rightparen commented 4 years ago

@anandRIyer I think I understand why I was not seeing your change.

It looks like you have updated the submodule repo to have the correct changes, but you have not yet updated the root rdt-reader repo to reference your updated submodule changes.

Specifically, in rdt-reader/tensorflow-yolov3 if I git checkout master && git pull --rebase, I see your updates and the project builds. However, if I then go back to rdt-reader and git status, then tensorflow-yolov3 shows up as modified. If I then git pull --rebase --recurse-submodules, the rdt-reader/tensorflow-yolov3 directory reverts back and your changes are no longer there.

So I think you need to pull/checkout master in rdt-reader/tensorflow-yolov3, then up in rdt-reader commit the submodule change and push that. Hopefully that should resolve the issue.

anandRIyer commented 4 years ago

Closing this as the issues discussed here are fixed