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

Docker do not merge #11

Open
wants to merge 6 commits into
base: master
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
11 changes: 11 additions & 0 deletions DOCKER.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
docker build -t sathub:latest .

v1
docker run --name sathub -p 5000:5000 -v /dev:/dev --privileged --rm sathub:latest

v2 - c/ usuário satjub
docker run --name sathub -p 5000:5000 -v /dev/ttyTS0:/dev/ttyTS0 --privileged --rm sathub:latest

v3
docker run --name sathub -p 5000:5000 --device=/dev/ttyTS0:/dev/ttyTS0 --privileged --rm sathub:latest

46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM python:3.8-alpine

RUN adduser -D sathub

WORKDIR /home/sathub

COPY ./requirements/base.txt requirements.txt

COPY ./dll/sat.ini /var/tanca_jetway/sat.ini
COPY ./dll/libsat_v3_0_0_3_x64.so /opt/tanca/libsat_v3_0_0_3_x64.so

RUN apk --no-cache add \
build-base \
python3 \
python3-dev \
# wget dependency
openssl \
# dev dependencies
bash \
git \
py3-pip \
sudo \
# Pillow dependencies
freetype-dev \
fribidi-dev \
harfbuzz-dev \
jpeg-dev \
lcms2-dev \
openjpeg-dev \
tcl-dev \
tiff-dev \
tk-dev \
zlib-dev \
zbar-dev && \
pip install -r requirements.txt
Comment on lines +13 to +35
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Melhorar essa lista de dependências, pois muitas são desnecessárias.


COPY runserver.py ./
COPY sathub ./sathub
COPY config-sathub.json ./
COPY dll ./dll

RUN chown -R sathub:sathub ./

USER sathub

CMD python runserver.py
Binary file added dll/libsat_v3_0_0_3_x64.so
Binary file not shown.
3 changes: 3 additions & 0 deletions dll/sat.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[DEFAULT]
SERIAL="/dev/ttyACM0"
DEBUG = true
4 changes: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Flask == 0.10.1
Flask-Login == 0.3.0
Flask-RESTful == 0.3.3
Flask-WTF == 0.12
Flask-WTF == 1.0.0
Unidecode == 0.04.18
satcomum >= 0.0.9
satcfe >= 0.0.8
werkzeug==0.16.1
itsdangerous==2.0.1
4 changes: 3 additions & 1 deletion sathub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# limitations under the License.
#

from __future__ import division, print_function, unicode_literals

import base64
import os

Expand All @@ -30,7 +32,7 @@
app = Flask(__name__)
app.debug = conf.is_debug
app.secret_key = os.environ.get('SATHUB_SECRET_KEY') or \
base64.b64encode('Nullum secretum est ubi regnat ebrietas')
base64.b64encode(b'Nullum secretum est ubi regnat ebrietas')

import sathub.api
import sathub.views
3 changes: 3 additions & 0 deletions sathub/comum/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import os
import sys

if sys.version_info[0] >= 3:
unicode = str

from logging.config import dictConfig

from cerberus import Validator
Expand Down
4 changes: 2 additions & 2 deletions sathub/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class LoginForm(Form):

username = StringField(u'Nome de Usuário',
validators=[
validators.required(),
validators.InputRequired(),
validators.length(min=2, max=20),])

password = PasswordField('Senha',
validators=[
validators.required(),
validators.InputRequired(),
validators.length(min=6, max=20),])

class Meta:
Expand Down