-
Notifications
You must be signed in to change notification settings - Fork 69
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
Docker #441
base: master
Are you sure you want to change the base?
Docker #441
Conversation
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 now back from traveling, apologies for the long delay.
Thanks! I finally had the excuse to play around with docker locally. It works well, however, I caught some typos in the readme; see suggested edits.
The other question is whether to rely on nikolaik/python-nodejs. I think I'd prefer to build something myself specifically for dwitter. But if everyone starts from ubuntu it would be slow to build for the first time, so the best approach is for me to maintain a docker image and host it somewhere?
I'm happy to keep nikolaik/ for now though, as it does work.
@@ -0,0 +1,13 @@ | |||
FROM nikolaik/python-nodejs: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.
As mentioned, I'm new to docker, but is there a way we can avoid this dependency without too much hassle? I think I'd much prefer to start with ubuntu and build dependencies on there, or potentially host a base image myself.
Thoughts?
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.
Maybe you could start from the official docker python image and then install nodejs.
https://hub.docker.com/_/python
Or start from the official nodejs image and add python, if that turns out to be easier/better.
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 mean, we shouldn't even need nodejs. So the official python image sounds like the way to go! Might be missing some django stuff, but we can install that during setup?
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 would assume anything you need after python will be installed automatically with pip when running make
which is already here. So just swapping out the base image for the python one should work if this is only intended for deployment. I see that the current node dependency is to install devDependencies from package.json for eslint support which is needed for development locally.
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.
Sounds good. Official python image is the way to go then :)
@@ -37,6 +37,12 @@ Inspired by [arkt.is/t/](http://arkt.is/t/Yy53aWR0aD0yZTM7eC5maWxsUmVjdCgxNTAsMT | |||
5. Get back in the main directory (`cd ../.. && make`) and use `make` command (install dependencies and set up database) | |||
6. Continue with the fourth step from **Linux setup**. | |||
|
|||
#### **Docker** | |||
1. Build the Docker image using the `Dockerfile` at the root directory of this project: `docker build -t dwitter .`. | |||
2. Run the migrations: `docker run -it -v $(pwd):/app dwitter make migrate`. |
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.
2. Run the migrations: `docker run -it -v $(pwd):/app dwitter make migrate`. | |
2. Run the migrations: `docker run -it -v $(pwd):/dwitter dwitter make migrate`. |
#### **Docker** | ||
1. Build the Docker image using the `Dockerfile` at the root directory of this project: `docker build -t dwitter .`. | ||
2. Run the migrations: `docker run -it -v $(pwd):/app dwitter make migrate`. | ||
3. Create the admin account: `docker run -it -v $(pwd):/app dwitter python manage.py createsuperuser`. |
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.
3. Create the admin account: `docker run -it -v $(pwd):/app dwitter python manage.py createsuperuser`. | |
3. Create the admin account: `docker run -it -v $(pwd):/dwitter dwitter python manage.py createsuperuser`. |
1. Build the Docker image using the `Dockerfile` at the root directory of this project: `docker build -t dwitter .`. | ||
2. Run the migrations: `docker run -it -v $(pwd):/app dwitter make migrate`. | ||
3. Create the admin account: `docker run -it -v $(pwd):/app dwitter python manage.py createsuperuser`. | ||
4. Run the app in a Docker container: `docker run -it -v $(pwd):/app -p 8000:8000 dwitter`. |
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.
4. Run the app in a Docker container: `docker run -it -v $(pwd):/app -p 8000:8000 dwitter`. | |
4. Run the app in a Docker container: `docker run -it -v $(pwd):/dwitter -p 8000:8000 dwitter`. |
Thanks for the feedback @lionleaf! I'll go through each comment individually, make edits, and let you know when it's ready for another review 👍 |
This adds a Dockerfile and documentation for using Docker to run this project locally.
make lint
to ensure that all the files are formatted and using best practices.I didn't include any advanced commands assuming that anyone who's familiar with Docker will be able to figure those out, but if you run into trouble or think I could improve the docs, just let me know!