PediatricOpenTargets / OpenPedCan-api

2 stars 7 forks source link

Question: How is `OpenPedCan-api` deployed with Jenkins? #5

Closed logstar closed 3 years ago

logstar commented 3 years ago

Hi @blackdenc - I was wondering how OpenPedCan-api is deployed with Jenkins. This general question is related to following two specific questions.

Can I add the following lines in Dockerfile to set a new working directory in the docker image, in order to prevent any overwriting of the files in /? Will it affect Jenkins deployment?

RUN mkdir /home/OpenPedCan-api
WORKDIR /home/OpenPedCan-api

Will Rscript main.R always be called under the ending WORKDIR of the Dockerfile? I am planning to assume the working directory is the ending Dockerfile WORKDIR, in order to split R files into multiple individual ones and load them in plumber.R.

cc @jharenza @jonkiky @komalsrathi @taylordm @chinwallaa

blackdenc commented 3 years ago

So to answer each one:

  1. You can add just WORKDIR /home/OpenPedCan-api to the Dockerfile on Line 2. I haven't tested that, but it should work, and the WORKDIR command will create the directory, so no need for the mkdir command first.
  2. It should run under the workdir, but I'd advise building it locally first.

As far as building in Jenkins, we build the container and tag it, then push it to ECR and give that tag to the ECS task definition at runtime. Adding a workdir shouldn't affect deployment as long as the container still builds and runs locally.

logstar commented 3 years ago

So to answer each one:

  1. You can add just WORKDIR /home/OpenPedCan-api to the Dockerfile on Line 2. I haven't tested that, but it should work, and the WORKDIR command will create the directory, so no need for the mkdir command first.
  2. It should run under the workdir, but I'd advise building it locally first.

As far as building in Jenkins, we build the container and tag it, then push it to ECR and give that tag to the ECS task definition at runtime. Adding a workdir shouldn't affect deployment as long as the container still builds and runs locally.

@blackdenc Thank you for the quick reply!