docker bush ended

This commit is contained in:
bacon
2024-03-22 01:07:29 +03:00
parent 62a8921e10
commit 37eef98e20
5 changed files with 24 additions and 16 deletions

11
.dockerignore Normal file
View File

@@ -0,0 +1,11 @@
/tmp/
audio/*/
/.idea
user.db
*.pyc
/.run/
.env
*.exe
/venv/
config.json
.editorconfig

View File

@@ -74,7 +74,7 @@ services:
- name: docker:25.0.5-dind
entrypoint: [ "env", "-u", "DOCKER_HOST" ]
Build:
make_image:
stage: build
image: docker:25.0.5-dind
services:

View File

@@ -1,24 +1,22 @@
FROM intel/intel-optimized-ffmpeg:avx2 as builder
FROM python:3.12.2-slim-bookworm as builder
LABEL authors="bacon"
WORKDIR /app
COPY requirements.txt /app
RUN apt-get update -qq && \
apt-get install -qq --no-install-recommends python3-pip -y && \
apt-get clean -qq autoclean && \
pip wheel install \
RUN pip wheel install \
--no-cache-dir -q \
--no-deps --wheel-dir /app/wheels \
-r requirements.txt
FROM intel/intel-optimized-ffmpeg:avx2 as runner
FROM python:3.12.2-slim-bookworm as runner
WORKDIR /app
COPY --from=builder /app/wheels /wheels
RUN apt-get update -qq && \
apt-get install -qq --no-install-recommends libopus-dev python3-pip -y && \
apt-get install -qq --no-install-recommends ffmpeg -y && \
apt-get clean -qq autoclean && \
pip install --no-cache -q /wheels/*
COPY src/ /app
ENTRYPOINT ["python3", "bot.py"]
ENTRYPOINT ["python", "bot.py"]
#ENTRYPOINT ["ffmpeg"]

View File

@@ -1,6 +1,6 @@
version: "1.0"
bootstrap: |
rm -rf .idea
pip install --quiet -U -r requirements.txt
pip install --quiet -r requirements.txt
profile:
name: qodana.recommended

View File

@@ -18,8 +18,7 @@ class DBReader:
try:
sql_con = connect("user.db")
cursor = sql_con.cursor()
cursor.execute("""SELECT * FROM "(guildid)" """,
{'guildid': guildid})
cursor.execute(f"""SELECT * FROM "{guildid}" """)
record = cursor.fetchall()
return record
except Error as _e:
@@ -86,9 +85,9 @@ async def prepare_db(guild: int):
try:
_connect = connect('user.db')
cursor = _connect.cursor()
cursor.execute(f'''CREATE TABLE IF NOT EXISTS "{guild}"
([userid] INTEGER PRIMARY KEY, [username] TEXT,
[nick] TEXT, [isbot] BOOL, [defaulttracks] TEXT, [usertracks] TEXT)''')
cursor.execute(f'CREATE TABLE IF NOT EXISTS "{guild}"\n'
f' ([userid] INTEGER PRIMARY KEY, [username] TEXT,\n'
f' [nick] TEXT, [isbot] BOOL, [defaulttracks] TEXT, [usertracks] TEXT)')
cursor.close()
except Error as _error:
logger.info(_error)
@@ -111,7 +110,7 @@ async def work_with_db(db_func: str, data_turple: tuple):
async def fill_bd(name: str, userid: int, isbot: bool, nick: str, guild: int):
sqlite_insert_with_param = (f"""INSERT OR IGNORE INTO "{guild}"
sqlite_insert_with_param = (f"""INSERT OR IGNORE INTO '{guild}'
(username, userid, nick, isbot)
VALUES (?, ?, ?, ?)""")
data_tuple: tuple[str, int, str, bool] = (name, userid, nick, isbot)