Skip to content

Commit 03e65e5

Browse files
authored
Merge pull request #1 from NetherQuartz/cobalt
Cobalt
2 parents 8c8c3d3 + fffc773 commit 03e65e5

11 files changed

Lines changed: 249 additions & 456 deletions

File tree

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Docker image
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
release:
7+
types: [ "created" ]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push-image:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Get release metadata
36+
id: release-meta
37+
run: |
38+
version=$(cat api/package.json | jq -r .version)
39+
echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
40+
echo "version=$version" >> $GITHUB_OUTPUT
41+
echo "major_version=$(echo "$version" | cut -d. -f1)" >> $GITHUB_OUTPUT
42+
- name: Extract metadata (tags, labels) for Docker
43+
id: meta
44+
uses: docker/metadata-action@v5
45+
with:
46+
tags: |
47+
type=raw,value=latest
48+
type=raw,value=${{ steps.release-meta.outputs.version }}
49+
type=raw,value=${{ steps.release-meta.outputs.major_version }}
50+
type=raw,value=${{ steps.release-meta.outputs.version }}-${{ steps.release-meta.outputs.commit_short }}
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
53+
- name: Build and push Docker image
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
platforms: linux/amd64,linux/arm64
58+
push: ${{ github.event_name == 'release' }}
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
cache-from: type=gha
62+
cache-to: type=gha,mode=max

.github/workflows/deploy.yml

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

Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
FROM python:3.12-alpine
1+
FROM alpine:3.20
22

33
WORKDIR /usr/app
44

55
ENV TZ Europe/Moscow
66

7-
ADD requirements.txt .
7+
RUN apk add --no-cache python3 py3-pip py3-opencv && \
8+
pip3 install --break-system-packages --no-cache-dir pytelegrambotapi aiohttp && \
9+
apk del py3-pip
810

9-
RUN apk update && apk add gcc musl-dev && \
10-
pip install --no-cache-dir -r requirements.txt && \
11-
apk del gcc musl-dev && apk cache clean
11+
ADD downloadbot downloadbot
1212

13-
ADD bot bot
14-
15-
ENTRYPOINT [ "python", "-m", "bot" ]
13+
ENTRYPOINT [ "python3", "-m", "downloadbot" ]

bot/__init__.py

Whitespace-only changes.

bot/__main__.py

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

0 commit comments

Comments
 (0)