Skip to content
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

WIP: Docker containers #75

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
.git
.vscode
.idea/
.DS_Store
*.md
LICENSE
*/node_modules/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# 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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
session_tmp/

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.environment
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
run: |
python3 -m pip install --upgrade pip
pip3 install pipenv
cd back-end
pipenv install
pipenv run echo "SECRET_KEY='TEMPORARY SECRET KEY'" > vp/.environment

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions back-end/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.8.2

WORKDIR /visual-programming/back-end

COPY Pipfile Pipfile.lock ./
COPY CLI/ ./CLI/
COPY pyworkflow/ ./pyworkflow/

RUN pip install pipenv
RUN pipenv install --dev --ignore-pipfile

COPY vp/ ./vp
RUN echo "SECRET_KEY=tmp" > vp/.environment

EXPOSE 8000

matthew-t-smith marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /visual-programming/back-end/vp

CMD pipenv run python manage.py runserver 0.0.0.0:8000
4 changes: 2 additions & 2 deletions Pipfile → back-end/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ django = "~=3.0.4"
pandas = "~=1.0.1"
python-dotenv = "~=0.12.0"
networkx = "~=2.4"
pyworkflow = {path = "./pyworkflow",editable = true}
pyworkflow = {path = "./pyworkflow", editable = true}
djangorestframework = "*"
drf-yasg = "*"
click = "*"
altair = "~=4.1.0"
cli = {path = "./CLI",editable = true}

[requires]
python_version = "3.8"
python_version = "3.8.2"
2 changes: 1 addition & 1 deletion Pipfile.lock → back-end/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions vp/manage.py → back-end/vp/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
"""Django's command-line utility for administrative tasks."""
import os
import sys

import dotenv


def main():
dotenv.load_dotenv(".environment")
matthew-t-smith marked this conversation as resolved.
Show resolved Hide resolved

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'vp.settings')
try:
from django.core.management import execute_from_command_line
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions vp/vp/settings.py → back-end/vp/vp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['back-end:8000',
'back-end',
'localhost',
'127.0.0.1',
'[::1]', ]


# Application definition
Expand Down Expand Up @@ -76,12 +80,10 @@

SESSION_ENGINE = 'django.contrib.sessions.backends.file'

matthew-t-smith marked this conversation as resolved.
Show resolved Hide resolved
WSGI_APPLICATION = 'vp.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
### Not yet setup
# Not yet setup
DATABASES = {}

MEDIA_ROOT = '/tmp'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3.3"
services:
back-end:
build: ./back-end
volumes:
- ./back-end:/visual-programming/back-end
ports:
- "8000:8000"
command: bash -c "pipenv run python manage.py runserver 0.0.0.0:8000"
environment:
- DJANGO_ENV=development
front-end:
build: ./front-end
volumes:
- ./front-end:/visual-programming/front-end
# One-way volume to use node_modules from inside image
- /visual-programming/front-end/node_modules
ports:
- "3000:3000"
environment:
- NODE_ENV=development
depends_on:
matthew-t-smith marked this conversation as resolved.
Show resolved Hide resolved
- back-end
links:
- back-end
command: npm start
14 changes: 14 additions & 0 deletions front-end/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:14-alpine

WORKDIR /visual-programming/front-end

COPY package.json .

RUN npm install

COPY src/ ./src/
COPY public/ ./public/

EXPOSE 3000

CMD npm start
2 changes: 1 addition & 1 deletion front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"last 1 safari version"
]
},
"proxy": "http://localhost:8000",
"proxy": "http://back-end:8000/"
"devDependencies": {
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.9.4",
Expand Down
Empty file removed vp/db.sqlite3
Empty file.