-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from darodi/pipeline_test
docker build pipeline
- Loading branch information
Showing
8 changed files
with
195 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
|
||
# 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 | ||
|
||
ENV OWNER_UID=1000 | ||
ENV OWNER_GID=1000 | ||
# 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" | ||
|
||
# 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" | ||
|
||
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
__version__ = "2021.09.05" | ||
__version__ = "2022.04.09" |
Oops, something went wrong.