diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4654adf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.8 AS builder +COPY requirements.txt . + +# install dependencies to the local user directory (eg. /root/.local) +RUN pip install --user -r requirements.txt + +# second stage +FROM python:3.8-slim +WORKDIR /code + +# copy only the dependencies that are needed for our application and the source files +COPY --from=builder /root/.local /root/.local +COPY ./src . + +# update PATH +ENV PATH=/root/.local:$PATH + +# make sure you include the -u flag to have our stdout logged +# CMD [ "python", "-u", "./main.py" ] +EXPOSE 8080 +# CMD [ "bash", "./run.sh" ] +CMD [ "python", "app.py" ] diff --git a/run.sh b/run.sh index 16d1c67..3276831 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1 @@ -#!/bin/bash - -source ./venv/bin/activate -python3 app.py +sudo podman run -d --name expense-bot --restart always localhost/expense-bot:0.1.0 diff --git a/app.py b/src/app.py similarity index 100% rename from app.py rename to src/app.py diff --git a/data/__init__.py b/src/data/__init__.py similarity index 100% rename from data/__init__.py rename to src/data/__init__.py diff --git a/data/config.py b/src/data/config.py similarity index 100% rename from data/config.py rename to src/data/config.py diff --git a/filters/__init__.py b/src/filters/__init__.py similarity index 100% rename from filters/__init__.py rename to src/filters/__init__.py diff --git a/handlers/__init__.py b/src/handlers/__init__.py similarity index 100% rename from handlers/__init__.py rename to src/handlers/__init__.py diff --git a/handlers/channels/__init__.py b/src/handlers/channels/__init__.py similarity index 100% rename from handlers/channels/__init__.py rename to src/handlers/channels/__init__.py diff --git a/handlers/errors/__init__.py b/src/handlers/errors/__init__.py similarity index 100% rename from handlers/errors/__init__.py rename to src/handlers/errors/__init__.py diff --git a/handlers/errors/error_handler.py b/src/handlers/errors/error_handler.py similarity index 100% rename from handlers/errors/error_handler.py rename to src/handlers/errors/error_handler.py diff --git a/handlers/groups/__init__.py b/src/handlers/groups/__init__.py similarity index 100% rename from handlers/groups/__init__.py rename to src/handlers/groups/__init__.py diff --git a/handlers/users/__init__.py b/src/handlers/users/__init__.py similarity index 100% rename from handlers/users/__init__.py rename to src/handlers/users/__init__.py diff --git a/handlers/users/add.py b/src/handlers/users/add.py similarity index 94% rename from handlers/users/add.py rename to src/handlers/users/add.py index b7dc837..0d944c4 100644 --- a/handlers/users/add.py +++ b/src/handlers/users/add.py @@ -1,10 +1,12 @@ from aiogram import types from loader import dp +import sqlite3 as sl @dp.message_handler(commands="add") async def bot_add(message: types.Message): await message.answer(f"This is ADD command, {message.from_user.username}!") + con = sl.connect('test.db') # @dp.message_handler(state=None) # todo сделать стейты. сейчас это хэндлит все сообщения в любых состояниях! # async def bot_add_parse_message(message: types.Message): diff --git a/handlers/users/currencies.py b/src/handlers/users/currencies.py similarity index 100% rename from handlers/users/currencies.py rename to src/handlers/users/currencies.py diff --git a/handlers/users/echo.py b/src/handlers/users/echo.py similarity index 100% rename from handlers/users/echo.py rename to src/handlers/users/echo.py diff --git a/handlers/users/help.py b/src/handlers/users/help.py similarity index 100% rename from handlers/users/help.py rename to src/handlers/users/help.py diff --git a/handlers/users/settings.py b/src/handlers/users/settings.py similarity index 100% rename from handlers/users/settings.py rename to src/handlers/users/settings.py diff --git a/handlers/users/start.py b/src/handlers/users/start.py similarity index 100% rename from handlers/users/start.py rename to src/handlers/users/start.py diff --git a/handlers/users/test.py b/src/handlers/users/test.py similarity index 100% rename from handlers/users/test.py rename to src/handlers/users/test.py diff --git a/keyboards/__init__.py b/src/keyboards/__init__.py similarity index 95% rename from keyboards/__init__.py rename to src/keyboards/__init__.py index 0b8947f..8abaca9 100644 --- a/keyboards/__init__.py +++ b/src/keyboards/__init__.py @@ -1,2 +1,2 @@ -from . import default -from . import inline +from . import default +from . import inline diff --git a/keyboards/default/__init__.py b/src/keyboards/default/__init__.py similarity index 100% rename from keyboards/default/__init__.py rename to src/keyboards/default/__init__.py diff --git a/keyboards/inline/__init__.py b/src/keyboards/inline/__init__.py similarity index 100% rename from keyboards/inline/__init__.py rename to src/keyboards/inline/__init__.py diff --git a/loader.py b/src/loader.py similarity index 100% rename from loader.py rename to src/loader.py diff --git a/middlewares/__init__.py b/src/middlewares/__init__.py similarity index 100% rename from middlewares/__init__.py rename to src/middlewares/__init__.py diff --git a/middlewares/throttling.py b/src/middlewares/throttling.py similarity index 100% rename from middlewares/throttling.py rename to src/middlewares/throttling.py diff --git a/states/__init__.py b/src/states/__init__.py similarity index 100% rename from states/__init__.py rename to src/states/__init__.py diff --git a/utils/__init__.py b/src/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to src/utils/__init__.py diff --git a/utils/db_api/__init__.py b/src/utils/db_api/__init__.py similarity index 100% rename from utils/db_api/__init__.py rename to src/utils/db_api/__init__.py diff --git a/utils/misc/__init__.py b/src/utils/misc/__init__.py similarity index 100% rename from utils/misc/__init__.py rename to src/utils/misc/__init__.py diff --git a/utils/misc/logging.py b/src/utils/misc/logging.py similarity index 100% rename from utils/misc/logging.py rename to src/utils/misc/logging.py diff --git a/utils/misc/throttling.py b/src/utils/misc/throttling.py similarity index 100% rename from utils/misc/throttling.py rename to src/utils/misc/throttling.py diff --git a/utils/notify_admins.py b/src/utils/notify_admins.py similarity index 100% rename from utils/notify_admins.py rename to src/utils/notify_admins.py diff --git a/utils/set_bot_commands.py b/src/utils/set_bot_commands.py similarity index 100% rename from utils/set_bot_commands.py rename to src/utils/set_bot_commands.py