Open-Network-Models-and-Interfaces-ONMI / TAPI

LF ONMI Transport API Repository (TAPI)
https://github.com/Open-Network-Models-and-Interfaces-ONMI/TAPI/wiki
Apache License 2.0
95 stars 80 forks source link

Problem with Docker version of Swagger Generate Server #371

Closed damianoneill closed 6 months ago

damianoneill commented 5 years ago

Following the Docker instructions from here

https://github.com/OpenNetworkingFoundation/TAPI/tree/develop/TAPI_RI/flask_server

I built the image with no issues, see below.

$ docker build -t tapi_server .
Sending build context to Docker daemon  1.484MB
Step 1/9 : FROM python:3-alpine
3-alpine: Pulling from library/python
4fe2ade4980c: Already exists
7cf6a1d62200: Pull complete
d16bb326b4ba: Pull complete
ed7df901e9a8: Pull complete
d7e55b1728aa: Pull complete
Digest: sha256:abc2a66d8ce0ddf14b1d51d4c1fe83f21059fa1c4952c02116cb9fd8d5cfd5c4
Status: Downloaded newer image for python:3-alpine
 ---> aadc3feb2b19
Step 2/9 : RUN mkdir -p /usr/src/app
 ---> Running in 094be0500df6
Removing intermediate container 094be0500df6
 ---> 4cae103c525d
Step 3/9 : WORKDIR /usr/src/app
 ---> Running in c0eab0c03745
Removing intermediate container c0eab0c03745
 ---> cd7298a51cbe
Step 4/9 : COPY requirements.txt /usr/src/app/
 ---> 7fb3cf576e51
Step 5/9 : RUN pip3 install --no-cache-dir -r requirements.txt
 ---> Running in 7b4cb7fb9977
Collecting connexion==1.1.15 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/06/45/e87be44f33982b2ee7b4fd5b1fe8bb616a22517f751f8fe2ee0b5567d231/connexion-1.1.15-py2.py3-none-any.whl (1.0MB)
Collecting python_dateutil==2.6.0 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/40/8b/275015d7a9ec293cf1bbf55433258fbc9d0711890a7f6dc538bac7b86bce/python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
Requirement already satisfied: setuptools>=21.0.0 in /usr/local/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (40.6.2)
Collecting swagger-spec-validator>=2.0.2 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/e8/3b/351ede61f9b34d46e3d254889b40ecbcc1521bdb87ad17c43a6b8e4b80b2/swagger_spec_validator-2.4.1-py2.py3-none-any.whl
Collecting six>=1.9 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting jsonschema>=2.5.1 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
Collecting requests>=2.9.1 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-py2.py3-none-any.whl (57kB)
Collecting clickclick>=1.2 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/b6/51/2b04f7a56dcbacc0e3a7cf726e1d88d28866bf488a7a0668582306e1e643/clickclick-1.2.2-py2.py3-none-any.whl
Collecting inflection>=0.3.1 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/d5/35/a6eb45b4e2356fe688b21570864d4aa0d0a880ce387defe9c589112077f8/inflection-0.3.1.tar.gz
Collecting PyYAML>=3.11 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)
Collecting flask>=0.10.1 (from connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl (91kB)
Collecting urllib3<1.25,>=1.21.1 (from requests>=2.9.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.9.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting idna<2.8,>=2.5 (from requests>=2.9.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
Collecting certifi>=2017.4.17 (from requests>=2.9.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/56/9d/1d02dd80bc4cd955f98980f28c5ee2200e1209292d5f9e9cc8d030d18655/certifi-2018.10.15-py2.py3-none-any.whl (146kB)
Collecting click>=4.0 (from clickclick>=1.2->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB)
Collecting Jinja2>=2.10 (from flask>=0.10.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
Collecting itsdangerous>=0.24 (from flask>=0.10.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Werkzeug>=0.14 (from flask>=0.10.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask>=0.10.1->connexion==1.1.15->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/ac/7e/1b4c2e05809a4414ebce0892fe1e32c14ace86ca7d50c70f00979ca9b3a3/MarkupSafe-1.1.0.tar.gz
Installing collected packages: six, jsonschema, PyYAML, swagger-spec-validator, urllib3, chardet, idna, certifi, requests, click, clickclick, inflection, MarkupSafe, Jinja2, itsdangerous, Werkzeug, flask, connexion, python-dateutil
  Running setup.py install for PyYAML: started
    Running setup.py install for PyYAML: finished with status 'done'
  Running setup.py install for inflection: started
    Running setup.py install for inflection: finished with status 'done'
  Running setup.py install for MarkupSafe: started
    Running setup.py install for MarkupSafe: finished with status 'done'
Successfully installed Jinja2-2.10 MarkupSafe-1.1.0 PyYAML-3.13 Werkzeug-0.14.1 certifi-2018.10.15 chardet-3.0.4 click-7.0 clickclick-1.2.2 connexion-1.1.15 flask-1.0.2 idna-2.7 inflection-0.3.1 itsdangerous-1.1.0 jsonschema-2.6.0 python-dateutil-2.6.0 requests-2.20.1 six-1.11.0 swagger-spec-validator-2.4.1 urllib3-1.24.1
Removing intermediate container 7b4cb7fb9977
 ---> f5bee8a70648
Step 6/9 : COPY . /usr/src/app
 ---> eaa1c21ed219
Step 7/9 : EXPOSE 8080
 ---> Running in 1bb4dc9a89cf
Removing intermediate container 1bb4dc9a89cf
 ---> aa06fe1937c8
Step 8/9 : ENTRYPOINT ["python3"]
 ---> Running in 9ac1a67b81b6
Removing intermediate container 9ac1a67b81b6
 ---> b049aa0e92d1
Step 9/9 : CMD ["-m", "tapi_server"]
 ---> Running in 80dbc74bf638
Removing intermediate container 80dbc74bf638
 ---> 31e776694da3
Successfully built 31e776694da3
Successfully tagged tapi_server:latest

When running the image I get the following output.

$ docker run -p 8080:8080 tapi_server
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/src/app/tapi_server/__main__.py", line 24, in <module>
    main()
  File "/usr/src/app/tapi_server/__main__.py", line 19, in main
    database.context = TapiContext.from_dict(data)
  File "/usr/src/app/tapi_server/models/tapi_context.py", line 95, in from_dict
    return util.deserialize_model(dikt, cls)
  File "/usr/src/app/tapi_server/util.py", line 111, in deserialize_model
    setattr(instance, attr, _deserialize(value, attr_type))
  File "/usr/src/app/tapi_server/util.py", line 26, in _deserialize
    elif type(klass) == typing.GenericMeta:
AttributeError: module 'typing' has no attribute 'GenericMeta'

The container doesn't start.

$ docker --version
Docker version 18.06.1-ce, build e68fc7a
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G1618
amazzini commented 6 months ago

This issue has been closed due to the lack of activity for more than one year. Please reopen it if follow up is necessary.