Добавил поддержку Docker

This commit is contained in:
Sergey Karmanov 2023-09-06 01:12:52 +03:00
parent e2ecdcd6f4
commit 4e009a1d7b
Signed by: serega404
GPG Key ID: B6AD49C8C835460C
3 changed files with 39 additions and 7 deletions

28
Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM python:3.11.2-alpine3.17
LABEL Maintainer="serega404"
ENV MUSL_LOCALE_DEPS cmake make musl-dev gcc gettext-dev libintl
ENV MUSL_LOCPATH /usr/share/i18n/locales/musl
RUN apk add --no-cache \
$MUSL_LOCALE_DEPS \
&& wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
&& unzip musl-locales-master.zip \
&& cd musl-locales-master \
&& cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
&& cd .. && rm -r musl-locales-master
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
# Setting up crontab
COPY crontab /tmp/crontab
RUN cat /tmp/crontab > /etc/crontabs/root
COPY main.py main.py
# run crond as main process of container
CMD ["crond", "-f", "-l", "2"]

2
crontab Normal file
View File

@ -0,0 +1,2 @@
@reboot cd /app && python3 /app/main.py
0 */6 * * * cd /app && python3 /app/main.py

View File

@ -33,6 +33,7 @@ else:
"url": url,
"imageUrl": imamgeurl
}
print("КиноНЕО | Найден фильм: " + title.text)
elements.append(jsonout)
headers = {"X-Platform": "widget", "X-Application-Token": "KMwvMv7qwz4IVNMu48cTot3PBNnYrifO"}
@ -55,6 +56,7 @@ else:
"url": "https://kinocharly.ru/51/release/" + str(release["id"]) + "?date=" + curDate,
"imageUrl": release["poster"]
}
print("Чарли | Найден фильм: " + release["title"])
elements.append(json)
request = requests.post(API_URL, json = elements)