From 645edec12513629f7f75f131d151a9f0317ebba0 Mon Sep 17 00:00:00 2001 From: Aitzol Date: Fri, 15 Dec 2023 13:11:40 +0100 Subject: [PATCH] dockerizazioa --- Dockerfile | 9 ++++++++- app.py | 10 ++++++---- requirements.txt | 4 ++++ start.sh | 4 ++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c44ee4..025eac8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM python:3-alpine + +ARG USER_ ARG UID_ +ENV USER_=admin ENV UID_=1000 RUN apk add --no-cache --upgrade bash @@ -16,4 +19,8 @@ RUN set -e; \ pip install -r requirements.txt; \ apk del .build-deps; -ENTRYPOINT ["./start.sh"] +#RUN adduser -S -D $USER -u $UID_ +#USER $USER + +ENTRYPOINT ["./start.sh", "$UID_"] +#CMD ["$UID_"] diff --git a/app.py b/app.py index 1493541..7b362c1 100644 --- a/app.py +++ b/app.py @@ -21,7 +21,8 @@ along with this program. If not, see . import bottle from bottle import get, post, static_file, request, route, template, error from bottle import SimpleTemplate -from bottle.ext import beaker +#from bottle.ext import beaker +from beaker.middleware import SessionMiddleware from configparser import ConfigParser from ldap3 import Server, Connection, ALL from ldap3 import SIMPLE, SUBTREE, MODIFY_REPLACE, MODIFY_ADD, MODIFY_DELETE, ALL_ATTRIBUTES @@ -437,11 +438,11 @@ def post_delete(): def serve_static(filename): return static_file(filename, root=path.join(BASE_DIR, 'static')) -@get("/static/fonts/") +@get("/static/fonts/") def font(filepath): return static_file(filepath, root="static/fonts") -@get("/static/tmp/") +@get("/static/tmp/") def font(filepath): return static_file(filepath, root="static/tmp") @@ -1198,7 +1199,8 @@ class SuperUsers(object): superUser = SuperUsers(CONF['ldap:0']) -app = beaker.middleware.SessionMiddleware(bottle.app(), session_opts) +#app = beaker.middleware.SessionMiddleware(bottle.app(), session_opts) +app = SessionMiddleware(bottle.app(), session_opts) bottle.TEMPLATE_PATH = [BASE_DIR] diff --git a/requirements.txt b/requirements.txt index 46db439..71ac5ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +Beaker>=1.12.1 bottle>=0.12.19 bottle-beaker>=0.1.3 ldap3>=2.9.1 @@ -5,3 +6,6 @@ uwsgi>=2.0.21 pyyaml>=6.0 ua-parser>=0.16.1 user-agents>=2.2.0 +cryptocode==0.1 +onetimepass==1.0.1 +segno==1.5.3 diff --git a/start.sh b/start.sh index 8cfc789..c4b5ee0 100755 --- a/start.sh +++ b/start.sh @@ -1,9 +1,9 @@ -############################## +#!/bin/bash +############################## ## Erabilera: ## ## sudo chmod +x start.sh ## ## ./start.sh $UID ## ############################## -#!/bin/bash if [ ! -f settings.ini ]; then cp settings.ini.example settings.ini fi