dockerizazioa

This commit is contained in:
Aitzol 2023-12-15 13:11:40 +01:00
parent 253c5c2491
commit 645edec125
4 changed files with 20 additions and 7 deletions

View File

@ -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_"]

10
app.py
View File

@ -21,7 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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/<filepath:re:.*\.(eot|otf|svg|ttf|woff|woff2?)>")
@get("/static/fonts/<filepath:re:.*\\.(eot|otf|svg|ttf|woff|woff2?)>")
def font(filepath):
return static_file(filepath, root="static/fonts")
@get("/static/tmp/<filepath:re:.*\.(png|svg)>")
@get("/static/tmp/<filepath:re:.*\\.(png|svg)>")
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]

View File

@ -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

View File

@ -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