groceri.es icon indicating copy to clipboard operation
groceri.es copied to clipboard

Freshly build Docker Image won't start

Open aidik opened this issue 1 year ago • 7 comments

While running a newly build Docker Image it will fail instantly with following error:

Checking for script in /app/prestart.sh
Running script /app/prestart.sh
Run flask migration upgrades (show current version first)
Usage: flask db current [OPTIONS]
Try 'flask db current --help' for help.

Error: While importing 'app', an ImportError was raised:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 256, in locate_app
    __import__(module_name)
  File "/app/app.py", line 6, in <module>
    from flask_login import LoginManager
  File "/usr/local/lib/python3.8/site-packages/flask_login/__init__.py", line 16, in <module>
    from .login_manager import LoginManager
  File "/usr/local/lib/python3.8/site-packages/flask_login/login_manager.py", line 24, in <module>
    from .utils import (login_url as make_login_url, _create_identifier,
  File "/usr/local/lib/python3.8/site-packages/flask_login/utils.py", line 13, in <module>
    from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (/usr/local/lib/python3.8/site-packages/werkzeug/security.py)

It might be related to https://stackoverflow.com/questions/71652965/importerror-cannot-import-name-safe-str-cmp-from-werkzeug-security

aidik avatar Aug 08 '22 10:08 aidik

This is indeed a Werkzeug 2.1.0 problem, as this package is included in the docker image I can't revert this back as suggested by the StackOverflow answers. I can however just update Flask-Login to be compatible with Werkzeug 2.1.0, let me test this so I can update all dependencies.

juriansluiman avatar Aug 09 '22 05:08 juriansluiman

@juriansluiman perhaps it could be interesting to integrate dependabot to make these tedious bits more automated in future ?

obbardc avatar Aug 10 '22 11:08 obbardc

Fixed in #25

obbardc avatar Aug 21 '22 10:08 obbardc

I was able to fix this by updating Flask-Login to 0.6.2 in requirements.txt

5t33 avatar Sep 03 '22 20:09 5t33

I have the same issue, updated flask login but it still happens.

henriquelino avatar Sep 06 '22 12:09 henriquelino

Worked for me with these versions in requirements.txt

Flask-Migrate==3.1.0
Flask-Login==0.6.2
Flask-Babel==2.0.0
Flask-WTF==1.0.1
python-slugify==6.1.2
pycountry==22.3.5
PyMySQL==1.0.2
sqlalchemy==1.3.24

shsethi avatar Sep 15 '22 10:09 shsethi

@juriansluiman can we please merge @obbardc PR (#25) or mine based on @shsethi proposal (#37) if you don't want dependabot. I'm using a mirror of this repo for publishing a docker image in a registry but it's a pain to automate if I have a divergent version. Thanks

Nindouja avatar Feb 18 '23 17:02 Nindouja