Skip to content

Commit 1ca99d2

Browse files
committed
Use uv instead of pip, switch to Alpine as base image
1 parent 2e15db3 commit 1ca99d2

8 files changed

Lines changed: 382 additions & 12 deletions

File tree

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Changelog
22

3-
## [3.2.0] - pending
3+
## [4.0.0] - pending
44

55
* Optional periodic import of history while listening for messages
6+
* Switch to using uv as Python package manager
7+
* Use Alpine as base image for Docker image (decreases image size from over 900 MB down to around 180 MB)
68

79
## [3.1.2] - 2023-11-08
810

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
FROM python:3.10-buster
1+
FROM alpine
2+
3+
ARG UV_VERSION=0.11.3
4+
5+
RUN apk add bash curl && \
6+
curl -L https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-musl.tar.gz | tar -C /usr/local/bin -zxp --strip-components=1
27

38
COPY output/*.py /app/output/
4-
COPY requirements.txt telegram2elastic.py /app/
9+
COPY .python-version pyproject.toml uv.lock telegram2elastic.py /app/
510

611
WORKDIR /app
712

8-
RUN pip install -r requirements.txt
13+
RUN uv sync --no-dev
914

1015
VOLUME /sessions
1116

12-
ENTRYPOINT ["/app/telegram2elastic.py"]
17+
ENTRYPOINT ["/app/telegram2elastic.py"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ With the data stored in Elasticsearch, you can use applications like Kibana or G
99

1010
## Requirements
1111

12-
* Python >= 3.10
12+
* [uv](https://github.com/astral-sh/uv)
1313
* Elasticsearch (in case you want to use the Elasticsearch output)
1414
* Redis (in case you want to use the Redis output)
1515
* Telegram API ID and API Hash (create one at [my.telegram.org](https://my.telegram.org))
1616

1717
## Installation
1818

1919
* Download the latest release
20-
* Install the required Python modules using pip: `pip3 install -r requirements.txt`
20+
* Install the required Python dependencies using uv: `uv sync`
2121
* Copy the provided config.sample.yml to config.yml and edit it to fit your needs
2222

2323
## Outputs

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[project]
2+
name = "telegram2elastic"
3+
version = "4.0.0"
4+
description = "A simple Telegram client writing chat messages to an Elasticsearch instance in realtime"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
dependencies = [
8+
"elasticsearch>=7,<9",
9+
"pyyaml>=5,<7",
10+
"redis~=4.5.1",
11+
"telethon~=1.40.0,<2",
12+
]
13+
14+
[dependency-groups]
15+
dev = [
16+
"pytest~=7.4.2",
17+
]

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

uv.lock

Lines changed: 350 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)