docker build pipeline
parent
ff4918355f
commit
779a4a5836
|
@ -1,6 +1,16 @@
|
|||
.git
|
||||
.github
|
||||
build
|
||||
comic_dl.egg-info
|
||||
comic_dl/dist
|
||||
comics
|
||||
.dockerignore
|
||||
.gitattributes
|
||||
.gitignore
|
||||
Dockerfile*
|
||||
docker-compose*
|
||||
.spec
|
||||
.travis.yml
|
||||
Dockerfile
|
||||
venv
|
||||
README.md
|
||||
LICENSE
|
||||
MANIFEST
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
name: Docker
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
#schedule:
|
||||
# - cron: '39 5 * * *'
|
||||
push:
|
||||
branches: [ master, pipeline_test ]
|
||||
# Publish semver tags as releases.
|
||||
tags: [ 'v*.*.*' ]
|
||||
|
||||
# Don't trigger if it's just a documentation update
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '**.MD'
|
||||
- '**.yml'
|
||||
- 'LICENSE'
|
||||
- '.gitattributes'
|
||||
- '.gitignore'
|
||||
- '.dockerignore'
|
||||
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# Don't trigger if it's just a documentation update
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '**.MD'
|
||||
- '**.yml'
|
||||
- 'LICENSE'
|
||||
- '.gitattributes'
|
||||
- '.gitignore'
|
||||
- '.dockerignore'
|
||||
|
||||
jobs:
|
||||
build_and_push:
|
||||
uses: sdr-enthusiasts/common-github-workflows/.github/workflows/build_and_push_image.yml@main
|
||||
with:
|
||||
platform_linux_arm32v7_enabled: true
|
||||
platform_linux_arm64v8_enabled: false
|
||||
push_enabled: true
|
||||
ghcr_repo_owner: ${{ github.repository_owner }}
|
||||
ghcr_repo: ${{ github.repository }}
|
||||
secrets:
|
||||
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -62,49 +62,20 @@ Temporary Items
|
|||
/idea
|
||||
/dist
|
||||
*.log
|
||||
*.xml
|
||||
*.xml
|
||||
*.iml
|
||||
*.spec
|
||||
comic_dl/Logo.ico
|
||||
comic_dl/build/__main__/warn__main__.txt
|
||||
*.old
|
||||
*.pdf
|
||||
*.old2
|
||||
comic_dl/build/__main__/xref-__main__.html
|
||||
*.xml___jb_tmp___
|
||||
comic_dl/Manga_Eden_Data.json
|
||||
*.mri
|
||||
comic_dl/dist/decryptor.py
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/include/webp/decode.h
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/include/webp/demux.h
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/include/webp/encode.h
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/include/webp/mux.h
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/include/webp/mux_types.h
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/include/webp/types.h
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/Readme-mux.txt
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/Readme.txt
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/test.webp
|
||||
comic_dl/dist/libwebp-0.6.1-windows-x64/test_ref.ppm
|
||||
comic_dl/dist/out.webp
|
||||
comic_dl/dist/upx394w/BUGS
|
||||
comic_dl/dist/upx394w/COPYING
|
||||
comic_dl/dist/upx394w/LICENSE
|
||||
comic_dl/dist/upx394w/Manga_Eden_Data.json
|
||||
comic_dl/dist/Manga_Eden_Data.json
|
||||
comic_dl/dist/upx394w/NEWS
|
||||
comic_dl/dist/upx394w/README
|
||||
comic_dl/dist/upx394w/README.1ST
|
||||
comic_dl/dist/upx394w/THANKS
|
||||
comic_dl/dist/upx394w/upx.1
|
||||
comic_dl/dist/upx394w/upx.doc
|
||||
comic_dl/dist/upx394w/upx.html
|
||||
comic_dl/config.json*
|
||||
comic_dl/build/__main__/localpycos/struct.pyo
|
||||
comic_dl/__main__.spec,old
|
||||
comic_dl/build/__main__/warn-__main__.txt
|
||||
venv/*
|
||||
build/*
|
||||
dist/*
|
||||
comic_dl/build/*
|
||||
comic_dl/dist/*
|
||||
/comic_dl.egg-info
|
||||
|
|
109
Dockerfile
109
Dockerfile
|
@ -1,32 +1,99 @@
|
|||
# build with command:
|
||||
# docker build -t comic-dl:py3.8-buster .
|
||||
# run with alias
|
||||
# alias comic_dl="docker run -it --rm -v $(pwd):/directory -w /directory comic-dl:py3.8-buster comic_dl -dd /directory"
|
||||
# alias comic_dl="docker run -it --rm -e PGID=$(id -g) -e PUID=$(id -u) -v $(pwd):/directory:rw -w /directory comic-dl:py3.8-buster comic_dl -dd /directory"
|
||||
|
||||
# this builds the base image to run comic_dl
|
||||
FROM python:3.8-slim-buster AS base
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -yq upgrade
|
||||
# update system & install basisc stuff
|
||||
# and dependencies for phantomjs
|
||||
# RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq \
|
||||
# build-essential \
|
||||
# chrpath \
|
||||
# libssl-dev \
|
||||
# libxft-dev \
|
||||
# libfreetype6 \
|
||||
# libfreetype6-dev \
|
||||
# libfontconfig1 \
|
||||
# libfontconfig1-dev
|
||||
# for armv7,
|
||||
# cross build it (it takes a few hours on x86_64), or be prepared to wait an eternity
|
||||
# build with command:
|
||||
# docker build -t comic-dl:py3.8-buster-armv7 --platform linux/arm/v7 .
|
||||
# export with command
|
||||
# docker save -o comic-dl.tar comic-dl:py3.8-buster-armv7
|
||||
# import on arm machine with command:
|
||||
# docker load --input comic-dl.tar
|
||||
# run with alias:
|
||||
# alias comic_dl="docker run -it --rm -e PGID=$(id -g) -e PUID=$(id -u) -v $(pwd):/directory:rw -w /directory comic-dl:py3.8-buster-armv7 comic_dl -dd /directory"
|
||||
|
||||
ENV OWNER_UID=1000
|
||||
ENV OWNER_GID=1000
|
||||
FROM --platform=linux/amd64 python:3.8-slim-buster as stage-amd64
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq upgrade
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
RUN echo "I'm building for $TARGETOS/$TARGETARCH/$TARGETVARIANT"
|
||||
|
||||
FROM --platform=linux/arm/v7 python:3.8-slim-buster as stage-armv7
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
RUN echo "I'm building for $TARGETOS/$TARGETARCH/$TARGETVARIANT"
|
||||
|
||||
ENV LC_ALL=C.UTF-8 \
|
||||
LANG=C.UTF-8 \
|
||||
LANGUAGE=en_US:en
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
## qpdf and pikepdf need to be built from source on armv7
|
||||
RUN set -x && \
|
||||
TEMP_PACKAGES=() && \
|
||||
KEPT_PACKAGES=() && \
|
||||
# Packages only required during build
|
||||
TEMP_PACKAGES+=(git) && \
|
||||
TEMP_PACKAGES+=(make) && \
|
||||
TEMP_PACKAGES+=(build-essential) && \
|
||||
TEMP_PACKAGES+=(libssl-dev) && \
|
||||
TEMP_PACKAGES+=(libfreetype6-dev) && \
|
||||
TEMP_PACKAGES+=(libfontconfig1-dev) && \
|
||||
TEMP_PACKAGES+=(libjpeg-dev) && \
|
||||
TEMP_PACKAGES+=(libqpdf-dev) && \
|
||||
TEMP_PACKAGES+=(libxft-dev) && \
|
||||
TEMP_PACKAGES+=(libxml2-dev) && \
|
||||
TEMP_PACKAGES+=(libxslt1-dev) && \
|
||||
TEMP_PACKAGES+=(zlib1g-dev) && \
|
||||
# Packages kept in the image
|
||||
KEPT_PACKAGES+=(bash) && \
|
||||
KEPT_PACKAGES+=(ca-certificates) && \
|
||||
KEPT_PACKAGES+=(locales) && \
|
||||
KEPT_PACKAGES+=(locales-all) && \
|
||||
KEPT_PACKAGES+=(python3) && \
|
||||
TEMP_PACKAGES+=(python3-dev) && \
|
||||
KEPT_PACKAGES+=(python3-pip) && \
|
||||
KEPT_PACKAGES+=(chrpath) && \
|
||||
KEPT_PACKAGES+=(libfreetype6) && \
|
||||
KEPT_PACKAGES+=(libfontconfig1) && \
|
||||
KEPT_PACKAGES+=(python3-wheel) && \
|
||||
# Install packages
|
||||
DEBIAN_FRONTEND=noninteractive apt-get update -y && apt-get -yq upgrade && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
${KEPT_PACKAGES[@]} \
|
||||
${TEMP_PACKAGES[@]} \
|
||||
&& \
|
||||
git config --global advice.detachedHead false && \
|
||||
# Install required python modules
|
||||
python -m pip install --upgrade pip && \
|
||||
python -m pip install --no-cache-dir pybind11 && \
|
||||
## qpdf and pikepdf need to be built from source on armv7
|
||||
cd /opt \
|
||||
&& git clone --branch release-qpdf-10.6.3 https://github.com/qpdf/qpdf.git \
|
||||
&& git clone --branch v5.1.1 https://github.com/pikepdf/pikepdf.git \
|
||||
&& cd /opt/qpdf \
|
||||
&& ./configure \
|
||||
&& make \
|
||||
&& make install \
|
||||
&& cd /opt/pikepdf \
|
||||
&& pip install . && \
|
||||
# Clean-up
|
||||
DEBIAN_FRONTEND=noninteractive apt-get remove -y ${TEMP_PACKAGES[@]} && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get autoremove -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get clean -y && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /src /opt/qpdf /opt/pikepdf
|
||||
|
||||
# Select final stage based on TARGETARCH ARG
|
||||
FROM stage-${TARGETARCH}${TARGETVARIANT} as final
|
||||
|
||||
COPY / /opt/comic-dl
|
||||
RUN python -m pip install --upgrade pip && \
|
||||
python -m pip install -r /opt/comic-dl/requirements.txt && \
|
||||
chmod +x /opt/comic-dl/docker-init.sh && \
|
||||
ln -s /opt/comic-dl/docker-init.sh /usr/local/bin/comic_dl && \
|
||||
addgroup --gid ${OWNER_GID} comic-dl && \
|
||||
adduser --disabled-password -home /home/comic-dl --gid ${OWNER_GID} --uid ${OWNER_UID} --gecos "" comic-dl
|
||||
|
||||
USER comic-dl
|
||||
cat /opt/comic-dl/comic_dl/__version__.py | grep version | awk '{print $3}' | sed 's/"//g' > /IMAGE_VERSION
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
# cross build it (it takes a few hours on x86_64), or be prepared to wait an eternity
|
||||
# build with command:
|
||||
# docker build -f Dockerfile.armv7 -t comic-dl:py3.8-buster-armv7 --platform linux/arm/v7 .
|
||||
# export with command
|
||||
# docker save -o comic-dl.tar comic-dl:py3.8-buster-armv7
|
||||
# import on arm machine with command:
|
||||
# docker load --input comic-dl.tar
|
||||
# run with alias:
|
||||
# alias comic_dl="docker run -it --rm -v $(pwd):/directory -w /directory comic-dl:py3.8-buster-armv7 comic_dl -dd /directory"
|
||||
|
||||
FROM python:3.8-slim-buster AS builder
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -yq upgrade \
|
||||
&& apt-get install -yq \
|
||||
build-essential \
|
||||
chrpath \
|
||||
git \
|
||||
libssl-dev \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
libfontconfig1 \
|
||||
libfontconfig1-dev \
|
||||
libjpeg-dev \
|
||||
libqpdf-dev \
|
||||
libxft-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
python3-wheel \
|
||||
zlib1g-dev
|
||||
|
||||
## qpdf and pikepdf need to be built from source on armv7
|
||||
RUN python -m pip install --upgrade pip \
|
||||
&& pip install pybind11 \
|
||||
&& cd /opt \
|
||||
&& git clone https://github.com/qpdf/qpdf.git \
|
||||
&& git clone https://github.com/pikepdf/pikepdf.git \
|
||||
&& cd /opt/qpdf \
|
||||
&& ./configure \
|
||||
&& make \
|
||||
&& make install \
|
||||
&& cd /opt/pikepdf \
|
||||
&& pip install .
|
||||
|
||||
ENV OWNER_UID=1000
|
||||
ENV OWNER_GID=1000
|
||||
|
||||
COPY / /opt/comic-dl
|
||||
RUN python -m pip install -r /opt/comic-dl/requirements.txt && \
|
||||
chmod +x /opt/comic-dl/docker-init.sh && \
|
||||
ln -s /opt/comic-dl/docker-init.sh /usr/local/bin/comic_dl && \
|
||||
addgroup --gid ${OWNER_GID} comic-dl && \
|
||||
adduser --disabled-password -home /home/comic-dl --gid ${OWNER_GID} --uid ${OWNER_UID} --gecos "" comic-dl
|
||||
|
||||
USER comic-dl
|
60
ReadMe.md
60
ReadMe.md
|
@ -1,5 +1,11 @@
|
|||
[![N|Solid](https://raw.githubusercontent.com/Xonshiz/comic-dl/master/Images/Icon.png)](https://github.com/Xonshiz/comic-dl)
|
||||
# Comic-DL | [![Build Status](https://travis-ci.com/Xonshiz/comic-dl.svg?branch=master)](https://travis-ci.com/Xonshiz/comic-dl) [![Documentation Status](https://readthedocs.org/projects/comic-dl/badge/?version=latest)](http://comic-dl.readthedocs.io/en/latest/?badge=latest) | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/xonshiz) | [![GitHub release](https://img.shields.io/github/release/xonshiz/comic-dl.svg?style=flat-square)](https://github.com/xonshiz/comic-dl/releases/latest) | [![Github All Releases](https://img.shields.io/github/downloads/xonshiz/comic-dl/total.svg?style=flat-square)](https://github.com/xonshiz/comic-dl/releases)
|
||||
# Comic-DL
|
||||
[![Build Status](https://travis-ci.com/Xonshiz/comic-dl.svg?branch=master)](https://travis-ci.com/Xonshiz/comic-dl) [![Documentation Status](https://readthedocs.org/projects/comic-dl/badge/?version=latest)](http://comic-dl.readthedocs.io/en/latest/?badge=latest) |
|
||||
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/xonshiz) |
|
||||
[![GitHub release](https://img.shields.io/github/release/xonshiz/comic-dl.svg?style=flat-square)](https://github.com/xonshiz/comic-dl/releases/latest) |
|
||||
[![Github All Releases](https://img.shields.io/github/downloads/xonshiz/comic-dl/total.svg?style=flat-square)](https://github.com/xonshiz/comic-dl/releases) |
|
||||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/xonshiz/comic-dl/Docker?label=docker%20build)](https://github.com/xonshiz/comic-dl/pkgs/container/comic-dl/)
|
||||
|
||||
|
||||
Comic-dl is a command line tool to download Comics and Manga from various Manga and Comic sites easily. You can search Manga from this tool as well. Idea from [youtube-dl](https://github.com/rg3/youtube-dl).
|
||||
|
||||
|
@ -24,8 +30,6 @@ If you're looking for an application, or a UI for this, please move to : [CoMang
|
|||
* [List of Arguments](#list-of-arguments)
|
||||
* [Language Codes](#language-codes)
|
||||
* [Using The Search](#using-the-search)
|
||||
* [
|
||||
Tutorial]()
|
||||
* [Usage](#usage)
|
||||
* [Windows](#windows)
|
||||
* [Linux/Debian](#linuxdebian)
|
||||
|
@ -101,32 +105,17 @@ With docker, you can get the whole dependencies enclosed in a container and use
|
|||
|
||||
You need an up and running Docker client running, follow the [Docker Documentation](https://docs.docker.com/install/).
|
||||
|
||||
A minimal example is here, you can change each step as you wish.
|
||||
[Docker images are available here](https://github.com/Xonshiz/comic-dl/pkgs/container/comic-dl/)
|
||||
|
||||
1. Clone this repo with `git clone [REPOSITORY URL.git]`
|
||||
Define a handy alias on your system with some docker tricks. This mounts the local directory under `/directory` in the container. This works on *NIX systems, and also under Windows Linux subsystem.
|
||||
|
||||
2. edit the OWNER_UID and OWNER_GID in the Dockerfile with the user needed in your download directory
|
||||
|
||||
you can determine the UID GID with the command `id`
|
||||
You can change the value of PGID and PUID with the value for the user needed in your download directory.
|
||||
|
||||
```bash
|
||||
user@DESKTOP:/home/user$ id
|
||||
uid=1000(user) gid=1000(user)
|
||||
alias comic_dl="docker run -it --rm -e PGID=$(id -g) -e PUID=$(id -u) -v $(pwd):/directory:rw -w /directory ghcr.io/Xonshiz/comic-dl:latest comic_dl -dd /directory"
|
||||
```
|
||||
|
||||
3. Build the image and give a name and a tag in the format `name:tag`. Here we are using `python:3.6.5-stretch` as base image, hence he tag.
|
||||
|
||||
```bash
|
||||
docker build -t comic-dl:py3.8-buster .
|
||||
```
|
||||
|
||||
4. Define an handy alias on your system with some docker tricks. This mounts the local directory under `/directory` in the container. This works on *NIX sistem, maybe also under Windows Linux subsystem (we need to Check).
|
||||
|
||||
```bash
|
||||
alias comic_dl="docker run -it --rm -v $(pwd):/directory -w /directory comic-dl:py3.8-buster comic_dl -dd /directory"
|
||||
```
|
||||
|
||||
5. Run it on your system. This actually starts a container on request and stop&delete it when finish.
|
||||
Run it on your system. This actually starts a container on request and stop&delete it when finished.
|
||||
|
||||
```bash
|
||||
usage: comicdl [-h] [--version] [-s SORTING] [-a] [-c]
|
||||
|
@ -139,28 +128,6 @@ usage: comicdl [-h] [--version] [-s SORTING] [-a] [-c]
|
|||
[...]
|
||||
```
|
||||
|
||||
### Docker armv7
|
||||
|
||||
It is recommended to cross build it. It takes a few hours on x86_64.
|
||||
|
||||
qpdf and pikepdf need to be built from source on armv7.
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.armv7 -t comic-dl:py3.8-buster-armv7 --platform linux/arm/v7 .
|
||||
docker save -o comic-dl.tar comic-dl:py3.8-buster-armv7
|
||||
```
|
||||
|
||||
and then import it on your arm machine.
|
||||
```bash
|
||||
docker load --input comic-dl.tar
|
||||
```
|
||||
|
||||
and then use the correct alias:
|
||||
|
||||
```bash
|
||||
alias comic_dl="docker run -it --rm -v $(pwd):/directory -w /directory comic-dl:py3.8-buster-armv7 comic_dl -dd /directory"
|
||||
```
|
||||
|
||||
## Python Support
|
||||
This script supports python 3. You can run this on python 2 as well, as long as you have all the dependencies installed.
|
||||
|
||||
|
@ -332,9 +299,6 @@ Our example command for One Piece, chapter 2 would be : `comic_dl.exe --page-id
|
|||
* If you download the chapter separately, you will need to provide the `Manga Name` and `Chapter Number` yourself. Because MangaEden's API doesn't list those values in their JSON reply (weird).
|
||||
|
||||
|
||||
## Youtube Tutorial
|
||||
[![Check The YouTube Tutorial](https://img.youtube.com/vi/TmQYhLHEZxA/0.jpg)]()
|
||||
|
||||
## Usage
|
||||
With this script, you have to pass arguments in order to be able to download anything. Passing arguments in a script is pretty easy. Since the script is pretty basic, it doesn't have too many arguments. Go check the [`ARGUMENTS SECTION`](https://github.com/Xonshiz/comic-dl#list-of-arguments) to know more about which arguments the script offers.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__version__ = "2021.09.05"
|
||||
__version__ = "2022.04.09"
|
||||
|
|
|
@ -1,2 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
python /opt/comic-dl/cli.py "$@"
|
||||
#!/bin/bash
|
||||
|
||||
# Create comic-dl homedir
|
||||
mkdir -p /home/comic-dl
|
||||
|
||||
# Set UID/PID of user that youtube-dl will be run as
|
||||
COMICDLPGID=${PGID:-1000}
|
||||
COMICDLPUID=${PUID:-1000}
|
||||
|
||||
# Check to see if group/user already exist, if so, delete
|
||||
EXISTINGGROUPNAME=$(getent group "$COMICDLPGID" | cut -d ':' -f 1)
|
||||
EXISTINGUSERNAME=$(getent passwd "$COMICDLPUID" | cut -d ':' -f 1)
|
||||
if [[ -n "$EXISTINGGROUPNAME" ]]; then
|
||||
groupdel -f "$EXISTINGGROUPNAME"
|
||||
fi
|
||||
if [[ -n "$EXISTINGUSERNAME" ]]; then
|
||||
userdel -f "$EXISTINGUSERNAME"
|
||||
fi
|
||||
|
||||
# Create user/group
|
||||
addgroup --quiet --gid "$COMICDLPGID" comic-dl
|
||||
chown -R "$COMICDLPUID":"$COMICDLPGID" /home/comic-dl
|
||||
adduser --quiet --system --disabled-password --uid "$COMICDLPUID" --gid "$COMICDLPGID" --home /home/comic-dl comic-dl
|
||||
HOME=/home/comic-dl
|
||||
export HOME
|
||||
|
||||
# Set UMASK if required
|
||||
if [[ -n "$UMASK" ]]; then
|
||||
umask "$UMASK"
|
||||
fi
|
||||
|
||||
# Run comic-dl with remainder of command line arguments
|
||||
setpriv --reuid comic-dl --regid comic-dl --keep-groups python3 /opt/comic-dl/cli.py "$@"
|
||||
|
||||
|
|
Loading…
Reference in New Issue