diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..e389642 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "formulahendry.vscode-mysql" + ] +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a0cb896..9e14766 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,11 @@ -FROM python:3.6.1-alpine -WORKDIR /project -ADD . /project -RUN pip install -r requirements.txt -CMD ["python","app.py"] \ No newline at end of file +FROM python:3.8-alpine +RUN apk add gcc musl-dev mariadb-connector-c-dev +COPY requirements.txt /tmp +WORKDIR /tmp +RUN pip install --upgrade pip && \ + pip install -r requirements.txt +RUN mkdir /app +WORKDIR /app +COPY app.py . +ENTRYPOINT [ "python" ] +CMD [ "app.py" ] \ No newline at end of file diff --git a/app.py b/app.py index eeb17e1..7ffb32b 100644 --- a/app.py +++ b/app.py @@ -14,13 +14,7 @@ def hello_world(): class Storage(): def __init__(self): - self.db = MySQLdb.connect( - user = os.getenv('MYSQL_USERNAME'), - passwd = os.getenv('MYSQL_PASSWORD'), - db = os.getenv('MYSQL_INSTANCE_NAME'), - host = os.getenv('MYSQL_PORT_3306_TCP_ADDR'), - port = int(os.getenv('MYSQL_PORT_3306_TCP_PORT')) - ) + self.db = MySQLdb.connect("192.168.2.106","db_user","Mytest123**","test_db" ) cur = self.db.cursor() cur.execute("CREATE TABLE IF NOT EXISTS scores(score INT)") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..89b3ba3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +flask +mysqlclient \ No newline at end of file