updated dockerfile and main.py

pull/2/head
etorameth 2024-02-07 14:17:29 +01:00
parent 62c2f668ae
commit 46c487a9b0
No known key found for this signature in database
2 changed files with 3 additions and 7 deletions

View File

@ -14,9 +14,7 @@ ENV PIP_DEFAULT_TIMEOUT=100 \
POETRY_VIRTUALENVS_CREATE=true \
POETRY_CACHE_DIR='/code/poetry-cache' \
POETRY_HOME='/code/poetry' \
POETRY_VERSION=1.7.1 \
# PrintServant:
PRINTSERVANT_HOST='http://host.docker.internal:3199'
POETRY_VERSION=1.7.1
RUN apt-get update && apt-get upgrade -y \
&& apt-get install --no-install-recommends -y \
@ -44,9 +42,7 @@ RUN groupadd -g "1000" -r web \
&& useradd -d '/code' -g web -l -r -u "1000" web \
&& chown web:web -R '/code'
RUN git clone https://code.hackerspace.pl/etorameth/labelmaker
WORKDIR /code/labelmaker
COPY . /code
USER web

View File

@ -96,7 +96,7 @@ def stuff_print(size):
renderer = Renderer()
renderer.render_text(text, 'Sans {}'.format(size), 0, -1, html)
data = img2pdf.convert(renderer.surface.write_to_png())
data = renderer.surface.write_to_png()
payload = {'printer': 'dymo_labelwriter450', 'copies': 1, 'body': data}
r = requests.post(os.environ.get('PRINTSERVANT_HOST') + '/print', params=payload)
print('Printing job response', r.text)