From d28244f425ac9349a9ec84756413ab18878da150 Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Tue, 3 May 2022 10:37:03 +0200 Subject: [PATCH] Fixed database packages and added Dockerfile --- requirements.txt | 2 +- source/.env.example | 2 +- source/Dockerfile | 17 +++++++++++++++++ source/deploy/start.sh | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 source/Dockerfile create mode 100644 source/deploy/start.sh diff --git a/requirements.txt b/requirements.txt index 24d040a..5b4b789 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,6 @@ pyTelegramBotAPI~=4.5.0 python-dotenv~=0.20.0 APScheduler~=3.9.1 SQLAlchemy~=1.4.36 -mysqlclient~=1.4.6 +pymysql==1.0.2 requests~=2.27.1 beautifulsoup4~=4.9.1 \ No newline at end of file diff --git a/source/.env.example b/source/.env.example index aa882c0..d9f160a 100644 --- a/source/.env.example +++ b/source/.env.example @@ -2,4 +2,4 @@ BOT_API_KEY= # Database -DATABASE_CONNECTION=mysql://scott:tiger@localhost/foo \ No newline at end of file +DATABASE_CONNECTION=mysql+pymysql://scott:tiger@localhost/foo \ No newline at end of file diff --git a/source/Dockerfile b/source/Dockerfile new file mode 100644 index 0000000..1ef23c2 --- /dev/null +++ b/source/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.10-slim + +# Change the working directory to the root of the project +WORKDIR /srv/flask_app + +# Install the dependencies +COPY requirements.txt /srv/flask_app/ +RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location + +# Copy the source code to the working directory +COPY source /srv/flask_app + +# Change file permissions +RUN chmod +x ./deploy/start.sh + +# Run the app +CMD ["./deploy/start.sh"] \ No newline at end of file diff --git a/source/deploy/start.sh b/source/deploy/start.sh new file mode 100644 index 0000000..05cc58f --- /dev/null +++ b/source/deploy/start.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +python bot.py