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: Feat/docker #20

Open
wants to merge 2 commits into
base: ep2016
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 80

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml,json}]
indent_size = 2

[Makefile]
indent_style = tab

[LICENSE]
insert_final_newline = none
trim_trailing_whitespace = none
indent_style = none
indent_size = none
80 changes: 78 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
*.pyc
.idea/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

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

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
cc-test-reporter

# pyenv
.python-version

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
.python-version
.envrc

# Rope project settings
.ropeproject

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

# Serverless
node_modules
.serverless

# IDEs
.vscode
.idea

# Sphinx temp
docs/_build
docs/source

*.ipynb_checkpoints/
*.ipynb
.node-version
51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.1
hooks:
- id: check-ast
- id: check-symlinks
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-json
- id: check-yaml
- id: detect-private-key
- id: double-quote-string-fixer
- id: trailing-whitespace
- id: no-commit-to-branch # No (direct) commits to master
- repo: https://github.com/asottile/add-trailing-comma
rev: v1.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.18
hooks:
- id: isort
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.6
hooks:
- id: forbid-crlf
files: \.md$
- id: remove-crlf
files: \.md$
- repo: local
hooks:
- id: lint
name: tox lint
entry: tox -e lint
language: system
- id: doclint
name: tox doclint
entry: tox -e doclint
language: system
- id: mypy
name: tox mypy
entry: tox -e mypy
language: system
types: [python]
- id: tests
name: tox tests
entry: tox -e tests
language: system
types: [python, yaml]
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FROM debian:buster

WORKDIR /opt

ADD . flask_nexttalk

RUN apt update \
&& apt -y upgrade \
&& apt -y install build-essential python3-dev python3-pip \
&& python3 -m pip install -U pip setuptools pipenv \
&& touch /tmp/mysite.sock \
&& chown www-data /tmp/mysite.sock \
&& cd flask_nexttalk/; pipenv install \
&& rm -rf /var/lib/apt/lists/* \


RUN ln -s /etc/uwsgi/apps-available/mysite.ini /etc/uwsgi/apps-enabled/mysite.ini \
&& service nginx restart \
&& service uwsgi restart

# command: /bin/bash -c "envsubst < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"

EXPOSE 80


# Now all we have to do is add our configuration files for nginx and uwsgi. First delete the default configuration for nginx:
# ```
# cd /etc/nginx/sites-available
# sudo rm default
# ```
# Create a new configuration file mysite and add the following:

# ```
# server {
# listen 80;
# server_tokens off;
# server_name localhost;

# location / {
# include uwsgi_params;
# uwsgi_pass unix:/tmp/mysite.sock;
# }

# location /static {
# alias /home/pi/App/flask-nexttalk/ep2017/static;
# }

# ## Only requests to our Host are allowed
# if ($host !~ ^(localhost)$ ) {
# return 444;
# }
# }
# ```
# NOTE: change ep2017 for your theme folder

# In order to enable the site, we must link our configuration file to /etc/nginx/sites-enabled/:

# ```
# sudo ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/mysite
# ```


19 changes: 19 additions & 0 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM balenalib/rpi-alpine:3.10

ENV TZ 'Europe/Berlin'

ENV SICKRAGE_VERSION 9.4.132

RUN apk add --update --no-cache libffi-dev openssl-dev libxml2-dev libxslt-dev linux-headers build-base \
git tzdata unrar \
python3 python3-dev
RUN git clone https://github.com/SiCKRAGE/SiCKRAGE.git -b ${SICKRAGE_VERSION} --depth 1 /opt/sickrage \
&& cd /opt/sickrage; git checkout ${SICKRAGE_VERSION} \
&& python3 -m pip install -U pip setuptools \
&& python3 -m pip install -r /opt/sickrage/requirements.txt

## Expose port
EXPOSE 8081

## Run
ENTRYPOINT ["python3", "/opt/sickrage/SiCKRAGE.py", "--datadir=/config"]
Loading