Dockerfile with CI

This commit is contained in:
Thomas Couchoud
2021-11-18 13:04:22 +01:00
parent b8f6fd09f0
commit 9ccf2f60ea
4 changed files with 107 additions and 0 deletions

6
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

35
.github/workflows/deploy-docker.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Doploy on Docker hub
on:
push:
branches: [master]
workflow_dispatch:
jobs:
deploy-docker:
name: Deploy docker hub
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2.4.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0
- name: Login to DockerHub
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2.7.0
with:
context: .
push: true
tags: |
mrcraftcod/twitch-miner:latest
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
Dockerfile Normal file
View File

@@ -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 \
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" ]

View File

@@ -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)
@@ -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
@@ -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.