Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Publish docker workflow #21

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,66 @@
name: Docker Publish

on:
release:
types: [created]
schedule:
- cron: "0 10 * * *"
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
nyaran/telegram-download-daemon-ng
ghcr.io/Nyaran/telegram-download-daemon-ng
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: user/app:latest
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Project
data
## Session file
*.session

Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ WORKDIR /app

COPY . /app

ENV TELEGRAM_DAEMON_DEST "/downloads"
ENV TELEGRAM_DAEMON_SESSION_PATH "/session"
ENV TELEGRAM_DAEMON_TEMP "/temp"

RUN python3 -m pip install /app

CMD [ "python3", "/app/src/telegram-download-daemon.py" ]
CMD [ "python3", "/app/src/telegram_download_daemon.py" ]
45 changes: 43 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,47 @@ You can also 'talk' to this daemon using your Telegram client:
* Say "status" to the daemon to check the current status.
* Say "clean" to remove stale (*.tdd) files from temporary directory.

# Docker
# Docker/Podman

TODO
> If you are using *Podman* instead of *Docker*, just replace the `docker` word in the following commands by `podman`.

On a terminal run:

```shell
docker pull nyaran/telegram-download-daemon-ng
```

Then run it.

Replace values for `TELEGRAM_DAEMON_API_ID`, `TELEGRAM_DAEMON_API_HASH` and `TELEGRAM_DAEMON_CHANNEL` (see the table
above), and set the paths for the volumes.

```shell
docker run \
--rm \
-e TELEGRAM_DAEMON_API_ID="YOUR_API_ID_HERE" \
-e TELEGRAM_DAEMON_API_HASH="YOUR_API_HASH_HERE" \
-e TELEGRAM_DAEMON_CHANNEL="YOUR_CHANNEL_ID_HERE" \
-v "DOWNLOADS_VOLUME_PATH_HERE":/downloads \
-v "SESSION_VOLUME_PATH_HERE":/session \
-v "TEMP_VOLUME_PATH_HERE":/temp \
--name telegram-download-daemon-ng \
nyaran/telegram-download-daemon-ng
```

Note. The first time, you need to generate your session, to do that, run the image in the interactive way, using `-it` (
is important
to use the same parameters)

```shell
docker run -it \
--rm \
-e TELEGRAM_DAEMON_API_ID="YOUR_API_ID_HERE" \
-e TELEGRAM_DAEMON_API_HASH="YOUR_API_HASH_HERE" \
-e TELEGRAM_DAEMON_CHANNEL="YOUR_CHANNEL_ID_HERE" \
-v "DOWNLOADS_VOLUME_PATH_HERE":/downloads \
-v "SESSION_VOLUME_PATH_HERE":/session \
-v "TEMP_VOLUME_PATH_HERE":/temp \
--name telegram-download-daemon-ng \
nyaran/telegram-download-daemon-ng
```
25 changes: 0 additions & 25 deletions docker-compose.yml

This file was deleted.