python with docker async def SyntaxError: invalid syntax

I have python app in virtualenv that leverage async function calls

Recently I tried moving my app to docker container, with following Dockerfile:

FROM python:3.7
ENV PYTHONUNBUFFERED 1
ADD . /code
WORKDIR /code

RUN pip install -r requirements.txt

CMD [“python3”, “app.py”]

docker-compose.yml:

version: ‘3’
services:
app:
build: .
volumes:
- .:/code
ports:
- “8080:80”

unfortunately, when trying to run my container with docker-compose up I get following error:

    Starting app_1 … done
Attaching to app_1
app_1 | File “app.py”, line 31
app_1 | async def handle_DATA(self, server, session, envelope):
app_1 | ^
app_1 | SyntaxError: invalid syntax
app_1 exited with code 1

What might be cause of this? As far as I know, from python 3.5 async is built-in in stdlib

#python #docker

13.25 GEEK