Dear all,
My API works locally when I run it on localhost but it does not work when I upload a Docker image to Google Cloud. The error is attached in a picture.
Here is my Dockerfile:
FROM python:3.8-slim-buster
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 app:app
I am using flask_restx with annotations to have Swagger. When I go to https://[API_URL]//swagger.json, I get the following response:
{"swagger": "2.0", "basePath": "/", "paths": {"/my models/": {"post": {"responses": {"200": {"description": "Success"}}, "summary": "Returns parameters", "operationId": "Get parameters.", "parameters": [{"name": "problem_name", "in": "query", "type": "string", "required": true, "enum": ["aa", "bb"], "collectionFormat": "multi"}, {"name": "type", "in": "query", "type": "string", "required": true, "enum": ["random"], "collectionFormat": "multi"}, {"name": "th", "in": "query", "type": "integer", "required": true, "enum": [10, 20], "collectionFormat": "multi"}, {"name": "num", "in": "query", "type": "integer", "required": true, "default": 1}], "tags": ["models"]}}}, "info": {"title": "API", "version": "1.0", "description": "API"}, "produces": ["application/json"], "consumes": ["application/json"], "tags": [{"name": "models", "description": "models"}], "responses": {"ParseError": {"description": "When a mask can't be parsed"}, "MaskError": {"description": "When any error occurs on mask"}}}
Would you point me in the right direction? Creating a Docker image is successful, as well as uploading it to Google Cloud.
Thanks.