-
Notifications
You must be signed in to change notification settings - Fork 1
Dockerize discoreg #4
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
e202e42
42588db
e1cab64
a12a6a3
e3d2e99
f1a621d
17adbec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM python:3.8 | ||
|
|
||
| ENV PYTHONUNBUFFERED 1 | ||
|
|
||
| WORKDIR /discoreg | ||
| EXPOSE 80 | ||
|
|
||
| COPY requirements.txt /discoreg | ||
| RUN pip3 install -r requirements.txt --no-cache-dir | ||
| COPY . /discoreg | ||
|
|
||
| ENTRYPOINT ["/discoreg/docker-entrypoint.sh"] | ||
| CMD ["sh"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM python:3.8 | ||
|
|
||
| ENV PYTHONUNBUFFERED 1 | ||
|
|
||
| WORKDIR /discoreg | ||
| EXPOSE 80 | ||
|
|
||
| COPY requirements.txt /discoreg | ||
| RUN pip3 install -r requirements.txt --no-cache-dir | ||
| COPY . /discoreg | ||
|
|
||
| ENTRYPOINT ["python3"] | ||
| CMD ["discoreg/manage.py", "nextupbot"] |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,23 @@ | ||
| # discoreg | ||
|
|
||
| A Django app to manage invites to a Discord server based on conference registrations. | ||
|
|
||
| # Building the docker image(s) | ||
|
|
||
| Ensure Docker Deskop is running locally and run this command. It will build the image and tag it with the name discoreg. (This will only build the web server) | ||
|
|
||
| ``` | ||
| docker build . -t discoreg | ||
| ``` | ||
|
|
||
| To build the nextupbot image, point to the specific Dockerfile for it | ||
|
|
||
| ``` | ||
| docker build . -t nextupbot -f Dockerfile.nextupbot | ||
| ``` | ||
|
|
||
| # Running disoreg with Docker Compose locally after building the images | ||
|
|
||
| ``` | ||
| docker-compose up --build | ||
| ``` |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably make the database configurable (e.g. with https://github.com/jazzband/dj-database-url) along with this change. In the mean time, I'll likely mount the path to the database as a docker volume to make sure it persists to disk. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| version: '3' | ||
|
|
||
| services: | ||
| web: | ||
| image: discoreg | ||
| build: | ||
| context: ./discoreg | ||
| dockerfile: Dockerfile | ||
| container_name: discoreg | ||
| ports: | ||
| - '80:80' | ||
| env_file: | ||
| - example.env | ||
| worker: | ||
| image: nextupbot | ||
| build: | ||
| context: ./discoreg | ||
| dockerfile: Dockerfile.nextupbot | ||
| container_name: nextupbot | ||
| env_file: | ||
| - example.env |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Collect static files | ||
| echo "Collect static files" | ||
| python3 discoreg/manage.py collectstatic --noinput | ||
|
|
||
| # Apply database migrations | ||
| echo "Apply database migrations" | ||
| python3 discoreg/manage.py migrate | ||
|
|
||
| # Start server | ||
| echo "Starting server" | ||
| gunicorn --pythonpath discoreg discoreg.wsgi --bind 0.0.0.0:80 --log-file - |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use something like |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| aiohttp==3.6.2 | ||
| asgiref==3.2.10 | ||
| async-timeout==3.0.1 | ||
| attrs==19.3.0 | ||
| bleach==3.1.5 | ||
| blinker==1.4 | ||
| certifi==2020.6.20 | ||
| chardet==3.0.4 | ||
| discord-py==1.3.4 | ||
| dj-database-url==0.5.0 | ||
| django==3.0.8 | ||
| django-heroku==0.3.1 | ||
| gunicorn==20.0.4 | ||
| idna==2.10 | ||
| importlib-metadata==1.7.0 | ||
| jsonpickle==1.4.1 | ||
| multidict==4.7.6 | ||
| oauthlib==3.1.0 | ||
| packaging==20.4 | ||
| psycopg2==2.8.5 | ||
| pyparsing==2.4.7 | ||
| pytz==2020.1 | ||
| pyyaml==5.3.1 | ||
| raygun4py==4.3.0 | ||
| requests==2.24.0 | ||
| requests-oauthlib==1.3.0 | ||
| six==1.15.0 | ||
| sqlparse==0.3.1 | ||
| urllib3==1.25.10 | ||
| webencodings==0.5.1 | ||
| websockets==8.1 | ||
| whitenoise==5.1.0 | ||
| yarl==1.4.2 | ||
| zipp==3.1.0 |
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.
We'll be running this behind nginx, so can we use 8000 (or whatever gunicorn's default port is) here?