-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
549 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: | ||
push: | ||
branches: ['release'] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM python:3.11-alpine AS builder | ||
|
||
RUN apk add poetry | ||
|
||
COPY . /build | ||
WORKDIR /build | ||
|
||
RUN poetry build --format wheel | ||
|
||
FROM python:3.11-alpine | ||
|
||
COPY --from=builder /build/dist/*.whl /root | ||
RUN pip install /root/*.whl | ||
|
||
CMD python -m picobot |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import json | ||
from functools import lru_cache | ||
from os import environ | ||
from pathlib import Path | ||
|
||
ROOT_DIR = Path(__file__).absolute().parent | ||
|
||
try: | ||
CONFIG_DIR = Path(environ['XDG_CONFIG_HOME'], 'picobot') | ||
except KeyError: | ||
CONFIG_DIR = Path.home() / '.config' / 'picobot' | ||
@lru_cache(1) | ||
def get_config_dir() -> Path: | ||
if 'PICOBOT_CONFIG_DIR' in environ: | ||
return Path(environ['PICOBOT_CONFIG_DIR']) | ||
|
||
if 'XDG_CONFIG_HOME' in environ: | ||
return Path(environ['XDG_CONFIG_HOME']) / 'picobot' | ||
|
||
return Path.home() / '.config' / 'picobot' | ||
|
||
CONFIG_DIR = get_config_dir() | ||
|
||
with open(CONFIG_DIR / 'config.json') as f: | ||
config = json.load(f) | ||
|
||
TOKEN = config['token'] | ||
DB_PATH = config.get('db_path', CONFIG_DIR / 'bot.db') | ||
CREATOR_ID = config.get('creator_id', 206454394) | ||
CREATOR_ID = config['creator_id'] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
[tool.poetry] | ||
name = "picobot" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
description = "" | ||
authors = ["Arthur Mesquita Pickcius <[email protected]>"] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.7" | ||
python = "^3.11" | ||
python-telegram-bot = "^13.11" | ||
dataset = "^1.1" | ||
pillow = "^9.3" | ||
|
@@ -14,14 +14,11 @@ emoji = "^0.6.0" | |
typed-ast = "^1.5.2" | ||
ffmpeg-python = "^0.2.0" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^3.0" | ||
flake8 = "^3.7" | ||
isort = "^4.3" | ||
black = {version = "^19.10b0", allow-prereleases = true} | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
black = {version = "^22.8.0", allow-prereleases = true} | ||
pytest = "^8.1.1" | ||
flake8 = "^7.0.0" | ||
isort = "^5.13.2" | ||
black = "^24.3.0" | ||
|
||
[tool.black] | ||
skip_string_normalization = true | ||
|