Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Make the app run with Docker
  • Loading branch information
tdemin committed Jun 13, 2019
1 parent 0229223 commit 9edcc79
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .dockerignore
@@ -0,0 +1,76 @@
# Copied from .gitignore.
.vscode
.git
.gitignore
config.json
*.db
__pycache__/
*.py[cod]
*$py.class
*.so
.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
*.manifest
*.spec
pip-log.txt
pip-delete-this-directory.txt
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
*.mo
*.pot
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
instance/
.webassets-cache
.scrapy
docs/_build/
target/
.ipynb_checkpoints
profile_default/
ipython_config.py
.python-version
celerybeat-schedule
*.sage.py
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.spyderproject
.spyproject
.ropeproject
/site
.mypy_cache/
.dmypy.json
dmypy.json
.pyre/
23 changes: 23 additions & 0 deletions Dockerfile
@@ -0,0 +1,23 @@
FROM python:3.7-alpine
LABEL maintainer "Timur Demin <me@tdem.in>"
WORKDIR /app
ENV UWSGI_PORT 8080
ENV UWSGI_PROCESSES 1
ENV UWSGI_THREADS 2

COPY requirements.txt setup.py setup.cfg /app/
COPY bin /app/bin
COPY --chown=0:0 doc/config.json.example /etc/amber.json
COPY project_amber /app/project_amber

# we need gcc to build cffi, which is required by bcrypt
RUN adduser -D -u 1000 amber && \
mkdir -p /data && chown amber /data && chmod 700 /data && \
apk add --no-cache build-base libffi-dev && \
pip install -r requirements.txt && \
pip install uwsgi && \
apk del build-base libffi-dev && \
chmod +x /app/bin/run_uwsgi.sh

USER amber
CMD [ "sh", "/app/bin/run_uwsgi.sh" ]
10 changes: 10 additions & 0 deletions bin/run_uwsgi.sh
@@ -0,0 +1,10 @@
#!/bin/sh

/usr/local/bin/uwsgi \
--http :${UWSGI_PORT} \
--master \
--plugin python,http \
--manage-script-name \
--mount /=project_amber:app \
--processes ${UWSGI_PROCESSES} \
--threads ${UWSGI_THREADS}
5 changes: 5 additions & 0 deletions doc/config.json.example
@@ -0,0 +1,5 @@
{
"database": "sqlite:////data/amber.db",
"allow_signup": true,
"loglevel": 2
}

0 comments on commit 9edcc79

Please sign in to comment.