Skip to content

Commit 4b90b8c

Browse files
committed
docker & ci & fixes
1 parent 6508084 commit 4b90b8c

File tree

15 files changed

+157
-25
lines changed

15 files changed

+157
-25
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**/.env
2+
**/.folds/
3+
**/.venv/
4+
**/__pycache__/
5+
.idea/
6+
*.iml

.github/workflows/meow.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
jobs:
7+
meow:
8+
runs-on: ubuntu-latest
9+
permissions: write-all
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
project: [avatar_emoji_bot, flexdo, smeshariki]
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: GHCR login
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
- name: Build and push
26+
uses: docker/build-push-action@v6
27+
with:
28+
push: true
29+
tags: ghcr.io/${{ github.repository }}:${{ matrix.project }}
30+
cache-from: type=gha
31+
cache-to: type=gha,mode=max
32+
file: examples/${{ matrix.project }}/Dockerfile
33+
- name: Deploy
34+
env:
35+
POMOGITE: ${{ secrets.POMOGITE }}
36+
run: |
37+
curl --request POST \
38+
--url https://vhap-update.vanutp.dev/update \
39+
--header "Content-Type: application/json" \
40+
--data '{"key":"'$POMOGITE'"}' \
41+
--fail

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
**/.env
2-
**/.folds/
2+
**/.folds/
3+
**/.venv/
4+
**/__pycache__/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM python:3.12-slim as base
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
3+
4+
WORKDIR /app
5+
6+
FROM base as builder
7+
ENV UV_COMPILE_BYTECODE=1
8+
ENV UV_LINK_MODE=copy
9+
10+
COPY pyproject.toml uv.lock ./
11+
COPY examples/avatar_emoji_bot/pyproject.toml examples/avatar_emoji_bot/
12+
13+
RUN --mount=type=cache,target=/root/.cache/uv \
14+
uv sync --project examples/avatar_emoji_bot --no-editable --frozen --no-dev --no-install-workspace
15+
16+
COPY . .
17+
18+
RUN --mount=type=cache,target=/root/.cache/uv \
19+
uv sync --project examples/avatar_emoji_bot --no-editable --frozen --no-dev
20+
21+
FROM base as runner
22+
COPY --from=builder /app/.venv .venv
23+
COPY examples/avatar_emoji_bot/mask.png ./
24+
ENV PATH="/app/.venv/bin:$PATH"
25+
26+
VOLUME /app/.folds
27+
28+
CMD ["python", "-m", "avatar_emoji_bot"]

examples/avatar_emoji_bot/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
name = "avatar-emoji-bot"
33
version = "0.1.0"
44
description = "Add your description here"
5-
readme = "readme.md"
65
authors = [
76
{ name = "Artem Ivanov", email = "art.ivanov@jetbrains.com" }
87
]
98
requires-python = ">=3.12"
109
dependencies = [
10+
"folds",
1111
"pillow>=11.1.0",
12+
"python-dotenv>=1.0.1",
1213
]
1314

1415
[project.scripts]
15-
avatar-emoji-bot = "avatar_emoji_bot:main"
16+
avatar-emoji-bot = "avatar_emoji_bot:__main__"
1617

1718
[build-system]
1819
requires = ["hatchling"]

examples/avatar_emoji_bot/src/avatar_emoji_bot/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from avatar_emoji_bot.utils import get_set_title, get_set_link, Emoji
1414
from folds.context import client
1515

16-
mask_image = Image.open('/Users/Art.Ivanov/dev/folds/examples/avatar_emoji_bot/mask.png').convert('L')
16+
mask_image = Image.open('mask.png').convert('L')
1717
fallback_emoji = '🟣'
1818

1919

examples/flexdo/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM python:3.12-slim as base
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
3+
4+
WORKDIR /app
5+
6+
FROM base as builder
7+
ENV UV_COMPILE_BYTECODE=1
8+
ENV UV_LINK_MODE=copy
9+
10+
COPY pyproject.toml uv.lock ./
11+
COPY examples/flexdo/pyproject.toml examples/flexdo/
12+
13+
RUN --mount=type=cache,target=/root/.cache/uv \
14+
uv sync --project examples/flexdo --no-editable --frozen --no-dev --no-install-workspace
15+
16+
COPY . .
17+
18+
RUN --mount=type=cache,target=/root/.cache/uv \
19+
uv sync --project examples/flexdo --no-editable --frozen --no-dev
20+
21+
FROM base as runner
22+
COPY --from=builder /app/.venv .venv
23+
ENV PATH="/app/.venv/bin:$PATH"
24+
25+
VOLUME /app/.folds
26+
27+
CMD ["python", "-m", "flexdo"]

examples/flexdo/pyproject.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
name = "flexdo"
33
version = "0.1.0"
44
description = "Add your description here"
5-
readme = "readme.md"
5+
authors = [
6+
{ name = "Artem Ivanov", email = "art.ivanov@jetbrains.com" }
7+
]
68
requires-python = ">=3.12"
79
dependencies = [
8-
"dotenv>=0.9.9",
910
"folds",
11+
"python-dotenv>=1.0.1",
1012
]
1113

12-
[tool.uv.sources]
13-
folds = { workspace = true }
14+
[project.scripts]
15+
flexdo = "flexdo:__main__"
16+
17+
[build-system]
18+
requires = ["hatchling"]
19+
build-backend = "hatchling.build"

examples/flexdo/readme.md

Whitespace-only changes.

0 commit comments

Comments
 (0)