Christoph Ludwig f3e3a724fb
Fix python-fastapi free-form objects mapping and forward ref type hints (#9723)
* map free-form objects to Dict[str, Any]

* support Forward Type References

Forward type references will be supported by default from Python 3.10 on only. Until then (and starting with Python 3.7), we can opt in by a __future__ import, cf. https://docs.python.org/3.9/whatsnew/3.7.html?highlight=forward#pep-563-postponed-evaluation-of-annotations

* re-created pet-store sample

* bump required Python version to 3.7 for generated FastAPI projects

* make pydantic modell classes process forward type references
2021-06-14 18:05:36 +08:00

31 lines
529 B
Docker

FROM python:3.7 AS builder
WORKDIR /usr/src/app
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
RUN pip install --upgrade pip
COPY . .
RUN pip install --no-cache-dir .
FROM python:3.7 AS test_runner
WORKDIR /tmp
COPY --from=builder /venv /venv
COPY --from=builder /usr/src/app/tests tests
ENV PATH=/venv/bin:$PATH
# install test dependencies
RUN pip install pytest
# run tests
RUN pytest tests
FROM python:3.7 AS service
WORKDIR /root/app/site-packages
COPY --from=test_runner /venv /venv
ENV PATH=/venv/bin:$PATH