New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize #97
Dockerize #97
Conversation
Hi @eriksjolund and @moonso. I know you're working with dockerizing other repos for the new server. Could you take a look at this PR and tell me what you think of my solution? Any suggestions? Another way of doing it is creating 2 Dockerfiles based on mongo, one for the backend and one for the frontend, but I like the modularity.. |
containers/frontend/Dockerfile
Outdated
@@ -0,0 +1,7 @@ | |||
FROM northwestwitch/cgbeacon2:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hosting the image on my docker hub now because I don't have access to the clinicalgenomics one, but I plan to move the images there
… backend and frontend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great @northwestwitch !! I had some comments but everything looks awesome
|
||
Run the containers and open an interactive shell for the backend by typing: | ||
``` | ||
docker-compose run beacon-cli /bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker-compose run beacon-cli /bin/bash | |
docker-compose run -d beacon-cli |
You can use -d
to run the container in background. Also you could add
CMD ["/bin/bash"]
to the Dockerfile instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I include the CMD command in the Dockerfile it's not usable any more for launching the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't use -d here because then it won't be interactive any more. I'd just get the ID of the image and I won't be able to type and run commands in the shell
- A working instance of **MongoDB**. From the mongo shell you can create a database using this syntax: | ||
|
||
<a name="docker"></a> | ||
## Installing and running the app using Docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if there was some test data and instruction for how to populate the database for testing only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll add the command to load the demo data!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command to load the data is actually already included in the demo, but I'll comment about it in the readme and the docs
containers/base/Dockerfile
Outdated
@@ -0,0 +1,15 @@ | |||
FROM python:3.8-alpine3.12 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LABEL maintainer="Chiara Rasi <chiara.rasi@scilifelab.se>" | |
You could also add some more labels here to describe the container. Have a look at @jemten and @henrikstranneheim examples in MIP for inspiration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check, thanks!
@@ -0,0 +1,115 @@ | |||
## Setting up a server from a Docker image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Again the test data would be nice here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR adds a minimal Dockerfile that allows to build both the frontend and the backend of this app.
fix #96
The code in the Dockerfile is the following:
It basically just installs all the requirements and the beacon on a container and then instructs to run any commands as a non-root user.
I've reasoned that since both frontend and backend belong to the same app they should share this basic module.
The additional layers such as the mongodb connection and the specific instructions might also be added in a modular way. At this regard I've included a docker-compose with a complete demo of the app that does the following:
How to prepare for test:
How to test:
docker-compose up
curl -X GET 'http://127.0.0.1:5000/apiv1.0/
Expected outcome:
Review:
This version is a: