Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"formulahendry.vscode-mysql"
]
}
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM python:3.6.1-alpine
WORKDIR /project
ADD . /project
RUN pip install -r requirements.txt
CMD ["python","app.py"]
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" ]
8 changes: 1 addition & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask
mysqlclient