Skip to content

Commit

Permalink
build(Build Docker Images): 👷
Browse files Browse the repository at this point in the history
  • Loading branch information
thezak48 committed Nov 14, 2023
1 parent 0974bf6 commit 5d529bc
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 89 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.vscode
renovate.json
.gitignore
data/*
systemd/*
README.md
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: build-and-push

on:
push:
branches:
- "main"
- "develop"
tags:
- '*'
paths-ignore:
- 'data/**'
- 'systemd/**'
- 'README.md'
- 'renovate.json'
pull_request:
branches:
- "develop"
paths-ignore:
- 'data/**'
- 'systemd/**'
- 'README.md'
- 'renovate.json'

jobs:
build-and-push-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: buildx

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/thezak48/manga_dl
flavor: |
latest=auto,type=ref,event=branch,value=main
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}
type=semver,pattern={{major}}
type=edge,branch=develop
type=ref,event=pr
type=sha
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_ZAK }}

- name: Docker build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event.pull_request.head.repo.full_name == 'thezak48/manga_dl' || github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
VCS_REF=${{ github.sha }}
VERSION=${{ steps.meta.outputs.tags }}
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM python:3.9-alpine

RUN echo "http://dl-4.alpinelinux.org/alpine/v3.14/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.14/community" >> /etc/apk/repositories


RUN apk --no-cache add chromium chromium-chromedriver
RUN pip install --upgrade pip

LABEL maintainer="thezak48" \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.url="https://github.com/thezak48/manga_dl" \
org.opencontainers.image.source="https://github.com/thezak48/manga_dl" \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.vendor="thezak48" \
org.opencontainers.image.title="manga_dl" \
org.opencontainers.image.description="manga_dl is an application to to download manga's, manhua's or manhwa's."

ENV PUID=1000
ENV PGID=1000
ENV PYTHONUNBUFFERED=1

COPY . /

RUN pip install --no-cache-dir -r requirements.txt

RUN addgroup -g $PGID appgroup && \
adduser -D -u $PUID -G appgroup appuser && \
mkdir -p /config && \
chown -R appuser:appgroup /config
USER appuser

CMD [ "python", "/manga_dl.py" ]
3 changes: 1 addition & 2 deletions data/config.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
mangas = ./data/manga.txt
multi_threaded = True
num_threads = 10
save_location = ./data/manga
driver_path = /usr/bin/chromedriver
save_location = ./data/manga
Loading

0 comments on commit 5d529bc

Please sign in to comment.