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

Dockerfile with CI #343

Merged
merged 5 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
35 changes: 35 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Doploy on Docker hub

on:
push:
branches: [master]
workflow_dispatch:
Tkd-Alex marked this conversation as resolved.
Show resolved Hide resolved

jobs:
deploy-docker:
name: Deploy docker hub
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/[email protected]
with:
context: .
push: true
tags: |
mrcraftcod/twitch-miner:latest
Tkd-Alex marked this conversation as resolved.
Show resolved Hide resolved
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: BUILDX_QEMU_ENV=true
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3-slim-buster

ARG BUILDX_QEMU_ENV

WORKDIR /usr/src/app

COPY ./miner/requirements.txt ./
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --fix-missing --no-install-recommends \
gcc \
libffi-dev \
rustc \
zlib1g-dev \
libjpeg-dev \
libssl-dev \
&& if [ "${BUILDX_QEMU_ENV}" = "true" ] && [ "$(getconf LONG_BIT)" = "32" ]; then \
Tkd-Alex marked this conversation as resolved.
Show resolved Hide resolved
pip install -U cryptography==3.3.2; \
fi \
&& pip install -r requirements.txt \
&& pip cache purge \
&& apt-get remove -y gcc rustc \
&& apt-get autoremove -y \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/share/doc/*

COPY ./miner .
CMD [ "python", "./main.py" ]
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Read more about channels point [here](https://help.twitch.tv/s/article/channel-p
- [Less logs](#less-logs)
- [Final report](#final-report)
4. 🧐 [How to use](#how-to-use)
- [Cloning](#by-cloning-the-repository)
- [Docker](#docker)
- [Limits](#limits)
5. 🔧 [Settings](#settings)
- [LoggerSettings](#loggersettings)
Expand Down Expand Up @@ -159,6 +161,9 @@ No browser needed. [#41](https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner
```

## How to use:

### By cloning the repository

1. Clone this repository `git clone https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2`
2. Install all the requirements `pip install -r requirements.txt` . If you have problems with requirements make sure to have at least Python3.6. You could also try to create a virtualenv and then install all the requirements
```sh
Expand Down Expand Up @@ -262,6 +267,38 @@ twitch_miner.mine(followers=True, blacklist=["user1", "user2"]) # Automatic use
```
4. Start mining! `python run.py`

### Docker

The following file is mounted :

- main.py : this is your starter script with your configuration

These folders are mounted :

- analytics : to save the analytics data
- cookies : to provide login information
- logs : to keep logs outside of container

Example using docker-compose:

```yml
version: "3.9"

services:
miner:
image: mrcraftcod/twitch-miner
tty: true
environment:
- TERM=xterm-256color
volumes:
- ./analytics:/usr/src/app/analytics
- ./cookies:/usr/src/app/cookies
- ./logs:/usr/src/app/logs
- ./main.py:/usr/src/app/main.py:ro
ports:
- "5000:5000"
```

### Limits
> Twitch has a limit - you can't watch more than 2 channels at one time. We take the first two streamers from the list as they have the highest priority.

Expand Down