Skip to content

Commit

Permalink
Resolve #31, Created docker configuration files
Browse files Browse the repository at this point in the history
Add Dockerfile for main project and separate Dockerfile
for webapp.
Same with docker-compose.yaml
Formatter run on script.js
Created 2 separate dev_requirements.txt files and crop out none essential
dependencies.
  • Loading branch information
ajwalkiewicz committed Jan 3, 2023
1 parent d6290f3 commit 4dbf95e
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 87 deletions.
144 changes: 144 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
.gitignore
# 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/

# Translations
*.mo
*.pot

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

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
# docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints
*.ipynb

# IPython
profile_default/
ipython_config.py

# pyenv
.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
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# VS code settings
.vscode

# mkdocs documentation
/site

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

# Pyre type checker
.pyre/

# vim
.swp
*.vim

# Others
miscelenious
credentials
*.temp
observations
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# apline 3.17 and python 3.8
# copied from https://github.com/docker-library/python/blob/f5b7b5a332bd4d2c1518325ab9647b09bf07412f/3.8/alpine3.17/Dockerfile

FROM ubuntu:20.04

# set the working directory
WORKDIR /cochar

RUN apt-get update
RUN apt-get upgrade --yes
RUN apt-get install python3.8 python3-pip --yes

# install dependencies
COPY ./dev_requirements.txt .

RUN pip install --no-cache-dir --upgrade -r dev_requirements.txt

# copy the scripts to the folder
COPY . /cochar

RUN pip install -e .
66 changes: 1 addition & 65 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,70 +1,6 @@
alabaster==0.7.12
aniso8601==9.0.1
attrs==22.1.0
Babel==2.10.3
black==22.6.0
bleach==5.0.0
certifi==2022.5.18.1
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.3
commonmark==0.9.1
cryptography==37.0.2
deepdiff==5.8.1
docutils==0.18.1
Flask==2.2.2
Flask-RESTful==0.3.9
idna==3.3
imagesize==1.4.1
importlib-metadata==4.11.4
iniconfig==1.1.1
itsdangerous==2.1.2
jeepney==0.8.0
Jinja2==3.1.2
keyring==23.5.0
Markdown==3.4.1
markdown-it-py==2.1.0
MarkupSafe==2.1.1
mccabe==0.7.0
mdit-py-plugins==0.3.0
mdurl==0.1.1
mypy-extensions==0.4.3
myst-parser==0.18.0
ordered-set==4.1.0
packaging==21.3
pathspec==0.9.0
pkginfo==1.8.2
platformdirs==2.5.2
pluggy==1.0.0
py==1.11.0
pycodestyle==2.10.0
pycparser==2.21
pyflakes==3.0.0
Pygments==2.12.0
pyparsing==3.0.9
pytest==7.1.2
pytz==2022.1
PyYAML==6.0
readme-renderer==35.0
requests==2.27.1
requests-toolbelt==0.9.1
rfc3986==2.0.0
rich==12.4.1
rname==0.3.7
SecretStorage==3.3.2
six==1.16.0
snowballstemmer==2.2.0
Sphinx==5.1.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==2.0.1
twine==4.0.0
typing-extensions==4.2.0
urllib3==1.26.9
webencodings==0.5.1
Werkzeug==2.2.2
zipp==3.8.0
pytest==7.1.2
7 changes: 7 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
app:
build: .
container_name: cochar-pkg
command: bash
volumes:
- .:/cochar
20 changes: 20 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.8-alpine

RUN apk add --no-cache --virtual .build-deps build-base linux-headers pcre-dev

# set the working directory
WORKDIR /webapp

# install dependencies
COPY ./dev_requirements.txt .
RUN pip install --no-cache-dir --upgrade -r dev_requirements.txt

# clean .build-deps
# RUN apk del --no-network .build-deps

# copy the scripts to the folder
COPY . /webapp

# start the server
CMD ["uwsgi", "--http", "0.0.0.0:80", "--master", "-p", "4", "-w", "wsgi", "--py-autoreload", "3"]
# CMD ["python3", "webapp.py"]
5 changes: 5 additions & 0 deletions webapp/dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
uWSGI==2.0.21
Flask==2.2.2
Flask-RESTful==0.3.9
Markdown==3.4.1
cochar==1.0.0a4
9 changes: 9 additions & 0 deletions webapp/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
app:
build: .
container_name: cochar-web
command: uwsgi --http 0.0.0.0:80 --master -p 4 -w wsgi --py-autoreload 1
ports:
- 80:80
volumes:
- .:/webapp
1 change: 0 additions & 1 deletion webapp/static/README.md

This file was deleted.

51 changes: 51 additions & 0 deletions webapp/static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# **C**all **O**f **C**thulhu **Char**acter Generator

Fast way of creating a random character for Chall of Cthulhu RPG 7th ed.

## Summary

`cochar` stands fo `Call of Cthulhu Character`. It's a python module design to create a full characters for Call of Cthulhu RPG 7th ed.

## Installation

```
pip3 install cochar
```

## Basic Usage

Example:

```Python
>>> from cochar import create_character
>>> person = create_character(1925, "US")
>>> person
Character(year=1925, country='US', first_name='Anthem', last_name='Pharr', age=22, sex='M', occupation='doctor of medicine', strength=33, condition=30, size=78, dexterity=40, appearance=23, education=87, intelligence=65, power=50, move_rate=7, luck=38, skills={'first aid': 38, 'language [latin]': 9, 'medicine': 73, 'science [biology]': 48, 'ride': 64, 'anthropology': 6, 'charm': 46, 'intimidate': 32, 'art/craft (sculptor)': 9, 'credit rating': 74, 'doge': 20}, damage_bonus='0', build=0, doge=20, sanity_points=50, magic_points=10, hit_points=10)
```

## Dependencies

`cochar` depends on [randname](github.com/ajwalkiewicz/randname) module for generating random names.

For more details please see:
- [randname github](github.com/ajwalkiewicz/randname)
- [randname pypi](https://pypi.org/project/rname/)

## Documentation

Detailed documentation of module can by found here:
[cochar documentation](https://ajwalkiewicz.github.io/cochar/_build/html/index.html#).

## Contribution

If you want to contribute to `cochar` project read [contribution](CONTRIBUTION.md) for more information.

## Authors & Contributors

**Author**: Adam Walkiewicz

**Contributors**: Be first!

## License

Cochar is licensed under the terms of the [GNU GPLv3](LICENSE)
Loading

0 comments on commit 4dbf95e

Please sign in to comment.