This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ncrmro/docker_deployment
Base Docker deployment
- Loading branch information
Showing
8 changed files
with
362 additions
and
5 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,195 @@ | ||
# Handle here so .docker doesn't pick these files up for a build . | ||
|
||
# Docs | ||
/LICENSE | ||
/README.md | ||
# Heroku | ||
/Procfile | ||
/runtime.txt | ||
# Deployment, CI | ||
/circle.yml | ||
/Dockerfile | ||
# Ignores' | ||
/.gitignore | ||
/.dockerignore | ||
# Dev | ||
*/db.sqlite3 | ||
|
||
|
||
|
||
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
### OSX template | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
### VirtualEnv template | ||
# Virtualenv | ||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ | ||
[Bb]in | ||
[Ii]nclude | ||
[Ll]ib | ||
[Ll]ib64 | ||
[Ll]ocal | ||
[Ss]cripts | ||
pyvenv.cfg | ||
.venv | ||
pip-selfcheck.json | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff: | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/dictionaries | ||
.idea/vcs.xml | ||
.idea/jsLibraryMappings.xml | ||
|
||
# Sensitive or high-churn files: | ||
.idea/dataSources.ids | ||
.idea/dataSources.xml | ||
.idea/dataSources.local.xml | ||
.idea/sqlDataSources.xml | ||
.idea/dynamic.xml | ||
.idea/uiDesigner.xml | ||
|
||
# Gradle: | ||
.idea/gradle.xml | ||
.idea/libraries | ||
|
||
# Mongo Explorer plugin: | ||
.idea/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
/out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
/src/staticfiles/ |
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,43 @@ | ||
FROM python:3.6-alpine | ||
|
||
ENV INSTALL_PATH=/ango/ \ | ||
DJANGO_SETTINGS_MODULE=ango.settings.prod \ | ||
SECRET_KEY=000000000000000 \ | ||
DATABASE_URL=postgres://admin:randomTestPassword@postgres:5432/admin \ | ||
ALLOWED_HOSTS=['*'] | ||
|
||
RUN mkdir $INSTALL_PATH | ||
|
||
WORKDIR $INSTALL_PATH | ||
|
||
COPY ./deps/ $INSTALL_PATH/deps/ | ||
|
||
RUN apk add --no-cache --virtual .build-deps \ | ||
build-base postgresql-dev libffi-dev \ | ||
&& pip3 install -r $INSTALL_PATH/deps/prod.txt \ | ||
&& find /usr/local \ | ||
\( -type d -a -name test -o -name tests \) \ | ||
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ | ||
-exec rm -rf '{}' + \ | ||
&& runDeps="$( \ | ||
scanelf --needed --nobanner --recursive /usr/local \ | ||
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ | ||
| sort -u \ | ||
| xargs -r apk info --installed \ | ||
| sort -u \ | ||
)" \ | ||
&& apk add --virtual .rundeps $runDeps \ | ||
&& apk del .build-deps | ||
|
||
COPY ./src $INSTALL_PATH | ||
|
||
COPY ./deps/nginx/ /etc/nginx/vhost.d/ | ||
|
||
|
||
RUN python3 manage.py collectstatic --no-input | ||
|
||
VOLUME ["/ango/staticfiles", "/etc/nginx/vhost.d"] | ||
|
||
EXPOSE 8000 | ||
|
||
ENTRYPOINT ["/usr/local/bin/python3", "-u"] |
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,5 @@ | ||
location /static { | ||
access_log off; | ||
log_not_found off; | ||
alias /ango/staticfiles; | ||
} |
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,36 @@ | ||
version: '2' | ||
services: | ||
nginx-proxy: | ||
image: jwilder/nginx-proxy | ||
container_name: nginx-proxy | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- /var/run/docker.sock:/tmp/docker.sock:ro | ||
volumes_from: | ||
- ango:ro | ||
|
||
postgres: | ||
image: kiasaki/alpine-postgres:9.5 | ||
container_name: postgres | ||
environment: | ||
- POSTGRES_USER=admin | ||
- POSTGRES_PASSWORD=randomTestPassword | ||
|
||
ango: | ||
build: . | ||
container_name: ango | ||
command: "/usr/local/bin/waitress-serve --host=0.0.0.0 --port=8000 ango.wsgi:application" | ||
image: ncrmro/ango | ||
volumes: | ||
- /ango/staticfiles | ||
- ./deps/nginx:/etc/nginx/vhost.d:ro | ||
environment: | ||
- VIRTUAL_HOST=192.168.99.101 | ||
- VIRTUAL_PORT=8000 | ||
- DJANGO_SETTINGS_MODULE=ango.settings.prod | ||
- SECRET_KEY='000000000000000' | ||
- DATABASE_URL=postgres://admin:randomTestPassword@postgres:5432/admin | ||
- ALLOWED_HOSTS=['*'] | ||
depends_on: | ||
- postgres |
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
Oops, something went wrong.