-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile for running the Django Web Application
[Problem] Eventually, we'll run the web app on Elastic Beanstalk over Docker. [Solution] Create a Dockerfile for running locally. Eventually, there will be a `Dockerfile.prod` that will have production settings minted in. [Test] Tested image with and without Auth0 enabled.
- Loading branch information
1 parent
9aba0d5
commit d2a5003
Showing
3 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM continuumio/miniconda:4.6.14 | ||
|
||
ENV SERVER_PORT 8000 | ||
ENV SRC_DIR /opt/waisn-tech-tools/ | ||
|
||
# copy source code | ||
RUN mkdir -p $SRC_DIR | ||
COPY ./environment-docker.yml $SRC_DIR | ||
COPY ./waisntechtools/waisntechtools/ $SRC_DIR/waisntechtools/waisntechtools/ | ||
COPY ./waisntechtools/alerts/ $SRC_DIR/waisntechtools/alerts | ||
COPY ./waisntechtools/manage.py $SRC_DIR/waisntechtools/manage.py | ||
|
||
# set up conda env | ||
WORKDIR $SRC_DIR | ||
RUN conda env create -f environment-docker.yml | ||
|
||
# run tests to sanity check image build | ||
WORKDIR $SRC_DIR/waisntechtools | ||
RUN . /opt/conda/etc/profile.d/conda.sh && \ | ||
conda activate waisn-tech-tools && \ | ||
python manage.py test | ||
|
||
# expose runtime port - exposing debug port for now until creating production configuration | ||
EXPOSE $SERVER_PORT | ||
|
||
# set up some environment variables | ||
ENV AUTH0_DOMAIN AUTH0_DOMAIN | ||
ENV AUTH0_KEY AUTH0_KEY | ||
ENV AUTH0_SECRET AUTH0_SECRET | ||
ENV WAISN_AUTH_DISABLED TRUE | ||
|
||
# run migrations | ||
RUN . /opt/conda/etc/profile.d/conda.sh && \ | ||
conda activate waisn-tech-tools && \ | ||
python manage.py migrate | ||
|
||
# run server | ||
ENTRYPOINT . /opt/conda/etc/profile.d/conda.sh && \ | ||
conda activate waisn-tech-tools && \ | ||
python manage.py runserver 0.0.0.0:$SERVER_PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: waisn-tech-tools | ||
channels: | ||
- defaults | ||
dependencies: | ||
- _libgcc_mutex=0.1=main | ||
- asn1crypto=0.24.0=py37_0 | ||
- beautifulsoup4=4.7.1=py37_1 | ||
- ca-certificates=2019.5.15=0 | ||
- certifi=2019.6.16=py37_0 | ||
- cffi=1.12.3=py37h2e261b9_0 | ||
- cryptography=2.7=py37h1ba5d50_0 | ||
- django=2.2.1=py37_0 | ||
- ecdsa=0.13=py37_1 | ||
- factory_boy=2.12.0=py37_0 | ||
- faker=1.0.7=py37_0 | ||
- future=0.17.1=py37_0 | ||
- gmp=6.1.2=h6c8ec71_1 | ||
- libedit=3.1.20181209=hc058e9b_0 | ||
- libffi=3.2.1=hd88cf55_4 | ||
- libgcc-ng=9.1.0=hdf63c60_0 | ||
- libstdcxx-ng=9.1.0=hdf63c60_0 | ||
- ncurses=6.1=he6710b0_1 | ||
- openssl=1.1.1c=h7b6447c_1 | ||
- pip=19.1.1=py37_0 | ||
- pyasn1=0.4.5=py_0 | ||
- pycparser=2.19=py37_0 | ||
- pycryptodome=3.7.3=py37hb69a4c5_0 | ||
- python=3.7.3=h0371630_0 | ||
- python-dateutil=2.8.0=py37_0 | ||
- python-jose=3.0.1=py_0 | ||
- pytz=2019.1=py_0 | ||
- readline=7.0=h7b6447c_5 | ||
- setuptools=41.0.1=py37_0 | ||
- six=1.12.0=py37_0 | ||
- soupsieve=1.8=py37_0 | ||
- sqlite=3.28.0=h7b6447c_0 | ||
- sqlparse=0.3.0=py_0 | ||
- text-unidecode=1.2=py37_0 | ||
- tk=8.6.8=hbc83047_0 | ||
- wheel=0.33.4=py37_0 | ||
- xz=5.2.4=h14c3975_4 | ||
- zlib=1.2.11=h7b6447c_3 | ||
- pip: | ||
- chardet==3.0.4 | ||
- defusedxml==0.6.0 | ||
- idna==2.8 | ||
- oauthlib==3.0.2 | ||
- pyjwt==1.7.1 | ||
- python3-openid==3.1.0 | ||
- requests==2.22.0 | ||
- requests-oauthlib==1.2.0 | ||
- social-auth-app-django==3.1.0 | ||
- social-auth-core==3.2.0 | ||
- transitions==0.6.9 | ||
- urllib3==1.25.3 | ||
prefix: /opt/conda/envs/waisn-tech-tools |