Skip to content

Commit

Permalink
adds proper image building with debian and PUID and PGID (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
speedyconzales authored May 2, 2024
1 parent 1f52d88 commit 4d98a63
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 42 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.git/
.DS_Store
*.mp4
.idea/
.vscode/
downloaded_files/
.github/
__pycache__/
*.py[cod]
*$py.class
test/
config.yml
10 changes: 7 additions & 3 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: download Dockerfile
run: curl -O https://raw.githubusercontent.com/speedyconzales/series-scraper/master/Dockerfile
- name: login to docker hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: login to ghcr
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: checkout lfs
run: git lfs checkout
- name: install buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -27,7 +31,7 @@ jobs:
docker buildx build --push \
--tag docker.io/speedyconzales/series-scraper:latest \
--tag ghcr.io/speedyconzales/series-scraper:latest \
--platform linux/amd64,linux/arm/v7,linux/arm64 .
--platform linux/amd64,linux/arm64 .
- name: Setup tmate session
if: failure()
timeout-minutes: 10
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config.yml
.vscode/
src/extensions/*/
downloaded_files/
test/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
39 changes: 8 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
# Stage 1: Checkout repository and prepare environment
FROM python:3.12.3-slim-bookworm AS builder
FROM ghcr.io/linuxserver/baseimage-debian:bookworm
LABEL org.opencontainers.image.source="https://github.com/speedyconzales/series-scraper"

# Set the working directory
WORKDIR /series-scraper
WORKDIR /app

# Install git and git-lfs for cloning the repository
RUN apt-get update && apt-get install -y git git-lfs
RUN git lfs install
COPY . /app/

# Copy the current directory contents into the container at /
RUN git clone https://github.com/speedyconzales/series-scraper.git /series-scraper
COPY root/ /

RUN mv template.yml config.yml
RUN chmod +x /etc/s6-overlay/s6-rc.d/init-series-scraper-config/run

# Stage 2: Final setup
FROM python:3.12.3-slim-bookworm AS final
LABEL org.opencontainers.image.source="https://github.com/speedyconzales/seroes-scraper"
RUN apt-get update && apt-get install -y chromium chromium-driver ffmpeg python3.11-full python3-pip

WORKDIR /series-scraper

COPY --from=builder /series-scraper /series-scraper

# Install any needed packages specified in requirements.txt
RUN pip install -r requirements.txt

# Install Chromium
RUN apt-get update && apt-get install -y chromium

# Install Chromium driver
RUN apt-get install -y chromium-driver

# Install FFmpeg
RUN apt-get install -y ffmpeg

# Set main.py as entrypoint
ENTRYPOINT ["python", "main.py"]
RUN python3 -m pip install -r requirements.txt --break-system-packages
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## Usage
1. if you are familiar with docker just use:
1. `docker pull speedyconzales/series-scraper`
2. `docker run --rm -v <path-to-your-anime-folder>:/series-scraper/anime -v <path-to-your-series-folder>:/series-scraper/series speedyconzales/series-scraper` followed by the arguments you want to provide
2. `docker run --rm -e PUID=<your_user_id> -e PGID=<your_group_id> -v <path-to-your-anime-folder>:/app/anime -v <path-to-your-series-folder>:/app/series speedyconzales/series-scraper s6-setuidgid abc python main.py` followed by the arguments you want to provide
2. if you don't want to use docker or there is no suitable docker image available for your architecture, you can use the following steps to run the scraper:
1. clone the repository
2. install the dependencies
Expand Down
7 changes: 0 additions & 7 deletions docker-compose.yml

This file was deleted.

Empty file.
9 changes: 9 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-series-scraper-config/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [[ ! -f /app/config.yml ]]; then
mv /app/template.yml /app/config.yml
fi
# permissions
lsiown -R abc:abc /app
lsiown -R abc:abc /usr/local/lib/python3.11
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-series-scraper-config/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-series-scraper-config/run
Empty file.

0 comments on commit 4d98a63

Please sign in to comment.