Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ac449f8 authored by Felix Ableitner's avatar Felix Ableitner
Browse files

Try to fix logging, improve Dockerfile

parent b1666cbc
Loading
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
FROM alpine:3.9
FROM python:3-alpine3.9

COPY app/ /usr/share/
RUN chmod 555 /usr/share/main.py \
 && apk add --no-cache python3 openssl \
 && apk add --no-cache --virtual build-deps build-base python3-dev libffi-dev openssl-dev \
 && pip3 install -r /usr/share/requirements.txt \
WORKDIR /usr/src/app

# TODO: create new user

COPY app/requirements.txt .

RUN apk add --no-cache openssl \
 && apk add --no-cache --virtual build-deps build-base libffi-dev openssl-dev \
 && pip install --upgrade pip \
 && pip install --no-cache-dir -r requirements.txt \
 && apk del build-deps
USER 9000

ENTRYPOINT ["python3", "/usr/share/main.py"]
 COPY app/ .

CMD [ "python3", "./main.py" ]
 No newline at end of file
+7 −1
Original line number Diff line number Diff line
@@ -7,6 +7,13 @@ import paramiko
import requests
from requests.auth import HTTPBasicAuth
import os
import logging
import sys

ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
logger = logging.getLogger('create-account').addHandler(ch)
paramiko.util.get_logger("paramiko").addHandler(ch)

HOST_NAME = '0.0.0.0'
PORT_NUMBER = 9000
@@ -19,7 +26,6 @@ class MyHandler(BaseHTTPRequestHandler):
            postvars = urllib.parse.parse_qs(self.rfile.read(length))
            postvars = {k.decode(): v[0].decode() for k, v in postvars.items()}

            self.respond(100, 'test')
            self.create_account(postvars['target_email'], postvars['password'], postvars['password_confirm'],
                                postvars['displayname'], postvars['email_quota'], postvars['fallback_email'],
                                postvars['nextcloud_quota'])