Adds Docker support, updates README.md and other few optimizations
This commit is contained in:
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM alpine:3.20.2
|
||||
|
||||
RUN apk update && apk upgrade --no-cache
|
||||
|
||||
RUN apk add --no-cache python3=3.12.3-r1 && \
|
||||
apk add pipx=1.6.0-r0
|
||||
|
||||
# Set environment variables
|
||||
ENV USER_NAME=builder
|
||||
ENV USER_UID=1001
|
||||
ENV USER_GID=1001
|
||||
|
||||
RUN addgroup -g $USER_GID $USER_NAME && \
|
||||
adduser -D -u $USER_UID -G $USER_NAME $USER_NAME
|
||||
|
||||
WORKDIR /home/$USER_NAME/myapp
|
||||
ENTRYPOINT ["./runDev.sh"]
|
||||
36
README.md
36
README.md
@@ -0,0 +1,36 @@
|
||||
# Initial Setup
|
||||
|
||||
## Install Python
|
||||
|
||||
- (With Python available on system with Mise) `pip install --user pipx`
|
||||
|
||||
## Install Poetry
|
||||
|
||||
- https://python-poetry.org/
|
||||
- `pipx install poetry`
|
||||
|
||||
## Install dependencies
|
||||
|
||||
- `https://python-poetry.org/docs/basic-usage/#installing-dependencies-only`
|
||||
|
||||
## Run the Editor
|
||||
|
||||
- `./runEditor.sh`
|
||||
|
||||
## Setup .env file
|
||||
|
||||
- Example:
|
||||
|
||||
```
|
||||
api_id=1234
|
||||
api_hash="foo"
|
||||
bot_token="bar"
|
||||
```
|
||||
|
||||
## Run the program
|
||||
|
||||
- `./runDev.sh`
|
||||
|
||||
## Build the Docker image for the project
|
||||
|
||||
- `./buildDockerImage.sh`
|
||||
|
||||
0
buildDockerImage.sh
Normal file
0
buildDockerImage.sh
Normal file
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
telegram-messages-manager:
|
||||
container_name: telegram-messages-manager
|
||||
build: .
|
||||
image: zak-clouds-manager-app:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- environment=development
|
||||
volumes:
|
||||
- .:/home/builder/myapp
|
||||
10
main.py
10
main.py
@@ -1,9 +1,19 @@
|
||||
import os
|
||||
|
||||
from getpass import getpass
|
||||
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from dotenv import dotenv_values
|
||||
|
||||
from telethon import TelegramClient, events
|
||||
|
||||
if (not os.path.isfile(".env")):
|
||||
# raise Exception("No .env file configuration. Please read \"README.md\" file")
|
||||
api_id_user=getpass("Please enter your API ID: ")
|
||||
api_hash_user=getpass("Please enter your API Hash: ")
|
||||
bot_token_user=getpass("Please enter your Bot Token: ")
|
||||
|
||||
config = dotenv_values(".env")
|
||||
|
||||
api_id = config["api_id"]
|
||||
|
||||
4
runEditor.sh
Executable file
4
runEditor.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
. $(poetry env info --path)/bin/activate
|
||||
$EDITOR
|
||||
Reference in New Issue
Block a user