forked from hswaw/labelmaker
updated dockerfile and main.py
parent
62c2f668ae
commit
46c487a9b0
|
@ -14,9 +14,7 @@ ENV PIP_DEFAULT_TIMEOUT=100 \
|
||||||
POETRY_VIRTUALENVS_CREATE=true \
|
POETRY_VIRTUALENVS_CREATE=true \
|
||||||
POETRY_CACHE_DIR='/code/poetry-cache' \
|
POETRY_CACHE_DIR='/code/poetry-cache' \
|
||||||
POETRY_HOME='/code/poetry' \
|
POETRY_HOME='/code/poetry' \
|
||||||
POETRY_VERSION=1.7.1 \
|
POETRY_VERSION=1.7.1
|
||||||
# PrintServant:
|
|
||||||
PRINTSERVANT_HOST='http://host.docker.internal:3199'
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y \
|
RUN apt-get update && apt-get upgrade -y \
|
||||||
&& apt-get install --no-install-recommends -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 \
|
&& useradd -d '/code' -g web -l -r -u "1000" web \
|
||||||
&& chown web:web -R '/code'
|
&& chown web:web -R '/code'
|
||||||
|
|
||||||
RUN git clone https://code.hackerspace.pl/etorameth/labelmaker
|
COPY . /code
|
||||||
|
|
||||||
WORKDIR /code/labelmaker
|
|
||||||
|
|
||||||
USER web
|
USER web
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ def stuff_print(size):
|
||||||
renderer = Renderer()
|
renderer = Renderer()
|
||||||
renderer.render_text(text, 'Sans {}'.format(size), 0, -1, html)
|
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}
|
payload = {'printer': 'dymo_labelwriter450', 'copies': 1, 'body': data}
|
||||||
r = requests.post(os.environ.get('PRINTSERVANT_HOST') + '/print', params=payload)
|
r = requests.post(os.environ.get('PRINTSERVANT_HOST') + '/print', params=payload)
|
||||||
print('Printing job response', r.text)
|
print('Printing job response', r.text)
|
||||||
|
|
Loading…
Reference in New Issue