Skip to content

Commit

Permalink
feat: Update all dependencies
Browse files Browse the repository at this point in the history
pytest==8.0.1
pytest-cov==4.1.0
pytest-flask==1.3.0
pytest-env==1.1.3
Flask==3.0.2
Flask-RESTful==0.3.10
Flask-CORS==4.0.0
WeasyPrint==61.0
Werkzeug==3.0.1
waitress==3.0.0
pypdf==4.0.1
Pillow==10.2.0
  • Loading branch information
ronisaha committed Feb 18, 2024
1 parent 3794f87 commit 69c1aa7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 21 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish to docker

on: [push]
on:
push:
branches:
- main

jobs:
push:
Expand All @@ -17,7 +20,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push docker images
run: |
WEASYPRINT_VERSION=57.2
WEASYPRINT_VERSION=61.0
IMAGE_ID=${{ secrets.DOCKERHUB_USERNAME }}/easy-pdf-rest
tmpName="image-$RANDOM"
docker build -f prod.Dockerfile --tag $tmpName .
Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3-bullseye AS builder
FROM python:3.12-bullseye AS builder
RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
RUN apt-get install -y --no-install-recommends --yes \
python3-venv \
Expand Down
4 changes: 2 additions & 2 deletions prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:slim-bullseye AS builder
FROM python:3.12-slim-bullseye AS builder
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev gtk+3.0 && \
python3 -m venv /venv && \
Expand Down Expand Up @@ -31,7 +31,7 @@ ENV FLASK_DEBUG="false"
RUN mkdir -p /data/templates && mkdir -p /data/reports

WORKDIR /app
ENTRYPOINT ["/venv/bin/waitress-serve", "--port=5000", "--host=0.0.0.0", "--call" ,"weasyprint_rest:app"]
ENTRYPOINT ["/venv/bin/waitress-serve", "--listen=*:5000", "--call" ,"weasyprint_rest:app"]

HEALTHCHECK --start-period=5s --interval=10s --timeout=10s --retries=5 \
CMD curl --silent --fail --request GET http://localhost:5000/api/v1.0/health \
Expand Down
24 changes: 12 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pytest==7.2.2
pytest-cov==4.0.0
pytest-flask==1.2.0
pytest-env==0.8.1
Flask==2.2.3
Flask-RESTful==0.3.9
Flask-CORS==3.0.10
WeasyPrint==57.2
Werkzeug==2.2.3
waitress==2.1.2
pypdf==3.7.0
Pillow==9.5.0
pytest==8.0.1
pytest-cov==4.1.0
pytest-flask==1.3.0
pytest-env==1.1.3
Flask==3.0.2
Flask-RESTful==0.3.10
Flask-CORS==4.0.0
WeasyPrint==61.0
Werkzeug==3.0.1
waitress==3.0.0
pypdf==4.0.1
Pillow==10.2.0
pdfkit==1.0.0
3 changes: 2 additions & 1 deletion weasyprint_rest/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
from .app import app

if __name__ == '__main__':
app().run(host='0.0.0.0', debug=is_debug_mode())
app().run(debug=is_debug_mode(), host='0.0.0.0')
print('Main run')
2 changes: 1 addition & 1 deletion weasyprint_rest/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_secret_key():


def is_debug_mode():
return is_true(get("FLASK_DEBUG"))
return is_true(get("ENABLE_DEBUG_MODE"))


def is_cors_enabled():
Expand Down
2 changes: 1 addition & 1 deletion weasyprint_rest/print/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def url_fetcher(self, url):
return self._resolve_file(url.split('?')[0])

if not check_url_access(url) and not BASE64_DATA_RE.match(url):
raise PermissionError('Requested URL %r was blocked because of restircion definitions.' % url)
raise PermissionError('Requested URL %r was blocked because of restriction definitions.' % url)

fetch_result = default_url_fetcher(url)
if fetch_result["mime_type"] == "text/plain":
Expand Down
2 changes: 1 addition & 1 deletion weasyprint_rest/print/weasyprinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _write_with_weasyprint(self, optimize_size):
font_config = self.template.get_font_config()
styles = self.template.get_styles() if self.template is not None else []
pdf_bytes = html.write_pdf(stylesheets=styles, image_cache=None, font_config=font_config,
optimize_size=optimize_size)
optimize_images=True)
return pdf_bytes

def _cleanup_dir(self, base_dir, html_file):
Expand Down

0 comments on commit 69c1aa7

Please sign in to comment.