Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Build not working anymore #299

Closed
MinehubDE opened this issue Nov 3, 2023 · 3 comments
Closed

Docker Build not working anymore #299

MinehubDE opened this issue Nov 3, 2023 · 3 comments

Comments

@MinehubDE
Copy link

After upgrading to the latest code and building the Docker image from it, snappass stops working and runs into an endless restart loop, due to the following error:

Traceback (most recent call last):
  File "/usr/local/bin/snappass", line 33, in <module>
    sys.exit(load_entry_point('snappass==1.6.0', 'console_scripts', 'snappass')())
  File "/usr/local/bin/snappass", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.8/site-packages/snappass-1.6.0-py3.8.egg/snappass/main.py", line 10, in <module>
    from werkzeug.urls import url_quote_plus
ImportError: cannot import name 'url_quote_plus' from 'werkzeug.urls' (/usr/local/lib/python3.8/site-packages/werkzeug-3.0.1-py3.8.egg/werkzeug/urls.py)

I assume it's caused by any version update from the requirements.txt, but couldn't figure out which constellation would result in a working app again.

@sebastiansterk
Copy link

sebastiansterk commented Nov 3, 2023

I faced the same issue. It looks like that there is a conflict between flask and snappass, both requiring a specific version of Werkzeug.

Workaround

requirements.txt

cryptography==41.0.4
Flask==2.3.2
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
redis==5.0.1
Werkzeug==2.3.3

Dockerfile

FROM python:3-alpine

RUN apk update && apk upgrade
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install snappass

ENTRYPOINT ["snappass"]

docker-compose.yaml

version: '2'

services:

    snappass:
        image: testsnappass
        ports:
            - "5000:5000"
        stop_signal: SIGINT
        environment:
            - REDIS_HOST=redis
            - NO_SSL=True
        depends_on:
          - redis

    redis:
        image: "redis:latest"

Run: docker image build -t testsnappass .; docker-compose up -d

Enjoy.

@petersmith-mp
Copy link

petersmith-mp commented Nov 13, 2023

Its missing PIP packages which aren't installed, i fixed it by removing requirements.txt from .dockerignore and adding

COPY requirements.txt .

RUN pip install -r requirements.txt

In the Dockerfile then it built and ran fine

@yurushao
Copy link
Contributor

yurushao commented Dec 1, 2023

Hi everyone, sorry for the late response. The issue should have been resolved by #303

@yurushao yurushao closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants