swagger-api / swagger-api/swagger-codegen

[Python-Flask] Default Dockerfile should pull `python:3.8-alpine`

Open
#10,891 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Python-flask generated code, once put into a docker container could not recognize arrays of strings and reported None until I updated the python container from FROM python:3.6-alpine to FROM Python:3.8-alpine.

Swagger-codegen version

Exported from swaggerhub.com so what ever is there.

Swagger declaration file content or url

https://app.swaggerhub.com/apis/lwileczek-dmc/caml-measurements/1.1.0

Command line used for generation
docker build . -t example_app:1.0.0
docker run --rm -p 8080:8080 -d example_app:1.0.0
curl -X POST 'http://localhost:8080/api/v1/write' -H "Content-Type: application/json" -d '
{
    "measurements":  {
        "performer": "team0", 
        "system": "dell", 
        "experiment": "myfile12.csv", 
        "replication-id": "4", 
        "replication-settings": {
            "rain": "heavy",
            "fog": false
        }, 
        "inference-system-time": "2021-12-31T23:59:60Z", 
        "inference-id": 333, 
        "inference-true-conditions": {
            "fog": true,
            "snow": true,
            "wind": true
        }, 
        "ml-strategy": "tree", 
        "ml-performance": 0.2, 
        "caml-conditions": ["horse", "car"], 
        "caml-performance": 0.6, 
        "caml-strategy": "tree" 
    },
    "connection": {"url": "http://localhost", "port": 9200, "username": "None", "password": "None", "index": "testcaml"} 
}'

The error is thrown by "caml-conditions": ["horse", "car"],

Suggest a fix/enhancement

generated dockerfile should pull from python:3.8-alpine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the Python-Flask generated Dockerfile template and inspect the base-image line; the issue identifies the current and desired Python Alpine images. Update the default to python:3.8-alpine, then run the provided docker build and docker run commands to verify the generated container uses the requested image and handles the example request.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, flask, python
Domain
backend, devops
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.