Skip to content

Commit

Permalink
Merge pull request #9 from NiNiyas/alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
NiNiyas authored Aug 17, 2024
2 parents 60ab69a + dd6ad78 commit f1f16c0
Show file tree
Hide file tree
Showing 37 changed files with 1,327 additions and 1,176 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ __pycache__/
*.log*

# databases
/*.db
*.db

# configs
*.cfg
/config/config.json
src/config/config.json

# generators
*.bat
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/ghcr-publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build and Push to GHCR

on:
workflow_dispatch:
repository_dispatch:
types: [Build and Push to GHCR]
workflow_dispatch: ~
push:
branches:
- master
Expand All @@ -13,32 +11,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Get Short SHA
uses: benjlevesque/short-sha@v2.2
uses: benjlevesque/short-sha@v3.0
id: short-sha
with:
length: 7

- name: Checkout
uses: actions/[email protected].1
uses: actions/[email protected].7

- name: Log into GHCR
run: echo "${{ secrets.GIT_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin

- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
uses: docker/setup-qemu-action@v3.1.0
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.4.0
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master

- name: Build and push amd64
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.3.0
with:
context: ./
file: ./Dockerfile
Expand All @@ -49,11 +47,10 @@ jobs:
ghcr.io/${{ secrets.GIT_USER }}/autoscan:amd64_commit-${{ steps.short-sha.outputs.sha }}
platforms: linux/amd64
build-args: |
OVERLAY_ARCH=amd64
ARCH=amd64
OVERLAY_ARCH=x86_64
- name: Build and push aarch64
uses: docker/build-push-action@v5.1.0
uses: docker/build-push-action@v6.3.0
with:
context: ./
file: ./Dockerfile
Expand All @@ -65,7 +62,6 @@ jobs:
platforms: linux/arm64
build-args: |
OVERLAY_ARCH=aarch64
ARCH=arm64
- name: Create and push manifest images
uses: Noelware/docker-manifest-action@master
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ __pycache__/
*.log*

# databases
/*.db
*.db

# configs
*.cfg
/config/config.json
src/config/config.json

# generators
*.bat
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
default_language_version:
python: python3.12

repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
language_version: python3.12
description: "Black: The uncompromising Python code formatter"
entry: black
language: python
41 changes: 15 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,38 @@
FROM alpine:latest

ARG ARCH
ARG OVERLAY_ARCH
ARG RCLONE_VERSION=1.65.0
ARG OVERLAY_VERSION=v2.2.0.3
ARG OVERLAY_VERSION=3.2.0.0

WORKDIR /opt/autoscan
WORKDIR /usr/src/app

COPY . .

ENV CONFIG_DIR="/config" \
PUID="1000" \
PGID="1000" \
UMASK="002" \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
PYTHONUNBUFFERED=1 \
PATH=/opt/plex_autoscan:${PATH} \
TZ=Europe/Brussels \
AUTOSCAN_CONFIG=/config/config.json \
AUTOSCAN_LOGFILE=/config/autoscan.log \
AUTOSCAN_LOGLEVEL=INFO \
AUTOSCAN_QUEUEFILE=/config/queue.db \
AUTOSCAN_CACHEFILE=/config/cache.db
AUTOSCAN_CACHEFILE=/config/cache.db \
AUTOSCAN_COMMAND=server

ARG RCLONE_URL="https://github.com/rclone/rclone/releases/download/v${RCLONE_VERSION}/rclone-v${RCLONE_VERSION}-linux-${ARCH}.zip"
ARG S6_URL="https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer"
RUN apk update && apk add --no-cache python3 py3-pip shadow bash docker-cli findutils inotify-tools && \
apk add --no-cache --virtual=build-deps gcc linux-headers musl-dev python3-dev curl wget xz unzip git

RUN wget -q -O rclone.zip $RCLONE_URL && \
unzip rclone.zip && \
mv rclone-*/rclone /bin/rclone && \
chmod +x /bin/rclone && \
rm -rf rclone.zip rclone-*
RUN curl https://rclone.org/install.sh | bash

RUN wget -q $S6_URL -O /tmp/s6-overlay-${OVERLAY_ARCH}-installer && \
chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && \
/tmp/s6-overlay-${OVERLAY_ARCH}-installer / && \
rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer

COPY . .
RUN curl -fsSL https://github.com/just-containers/s6-overlay/releases/download/v${OVERLAY_VERSION}/s6-overlay-noarch.tar.xz | tar Jpxf - -C / && \
curl -fsSL https://github.com/just-containers/s6-overlay/releases/download/v${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}.tar.xz | tar Jpxf - -C / && \
curl -fsSL https://github.com/just-containers/s6-overlay/releases/download/v${OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz | tar Jpxf - -C / && \
curl -fsSL https://github.com/just-containers/s6-overlay/releases/download/v${OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz | tar Jpxf - -C /

RUN apk add --no-cache --upgrade python3 git py3-pip py3-setuptools shadow bash docker-cli && \
apk --no-cache --virtual=build-deps add gcc linux-headers musl-dev python3-dev && \
pip install -U --no-cache-dir pip idna wheel --break-system-packages && \
pip install -U --no-cache-dir pip -r requirements.txt --break-system-packages && \
apk --purge del build-deps && \
ln -s /opt/plex_autoscan/config /config
RUN pip install --no-cache-dir -r requirements.txt --break-system-packages && \
apk --purge del build-deps

COPY /root /

Expand All @@ -58,5 +48,4 @@ VOLUME ["/config", "/plexDb"]

EXPOSE 3468/tcp

CMD ["python3", "scan.py" , "server"]
ENTRYPOINT ["/init"]
Loading

0 comments on commit f1f16c0

Please sign in to comment.