This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
188 additions
and
115 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
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,33 +1,65 @@ | ||
FROM python:3.8-slim | ||
LABEL maintainer="VergilGao" | ||
FROM python:3.8-alpine as build-stage | ||
|
||
# 软件包版本号 | ||
ARG MDC_VERSION | ||
ARG PYINSTALLER_TAG | ||
ENV PYINSTALLER_TAG ${PYINSTALLER_TAG:-"v4.8"} | ||
|
||
# Official Python base image is needed or some applications will segfault. | ||
# PyInstaller needs zlib-dev, gcc, libc-dev, and musl-dev | ||
RUN apk --update --no-cache add \ | ||
zlib-dev \ | ||
musl-dev \ | ||
libc-dev \ | ||
libffi-dev \ | ||
gcc \ | ||
g++ \ | ||
git \ | ||
pwgen \ | ||
jpeg-dev \ | ||
# Pillow depenencies | ||
freetype-dev \ | ||
lcms2-dev \ | ||
openjpeg-dev \ | ||
tiff-dev \ | ||
tk-dev \ | ||
tcl-dev \ | ||
# mdc builder depenencies | ||
libxml2-dev \ | ||
libxslt-dev && \ | ||
pip install --upgrade pip | ||
|
||
RUN git clone https://github.com/python-pillow/Pillow.git /Pillow | ||
RUN pip install virtualenv && virtualenv /vpy && source /vpy/bin/activate && pip install nose | ||
|
||
# Build bootloader for alpine | ||
RUN git clone --depth 1 --single-branch --branch ${PYINSTALLER_TAG} https://github.com/pyinstaller/pyinstaller.git /tmp/pyinstaller \ | ||
&& cd /tmp/pyinstaller/bootloader \ | ||
&& CFLAGS="-Wno-stringop-overflow -Wno-stringop-truncation" python ./waf configure --no-lsb all \ | ||
&& pip install .. \ | ||
&& rm -Rf /tmp/pyinstaller | ||
|
||
ADD ./root /pyinstaller | ||
RUN chmod a+x /pyinstaller/* | ||
|
||
RUN git clone --depth=1 -b 6.0.1 https://github.com/yoshiko2/Movie_Data_Capture.git /tmp/src | ||
RUN cd /tmp/src && pip install -r requirements.txt | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y wget ca-certificates && \ | ||
mkdir build && \ | ||
cd build && \ | ||
wget -O - https://github.com/yoshiko2/Movie_Data_Capture/archive/${MDC_VERSION}.tar.gz | tar xz && \ | ||
mv Movie_Data_Capture-${MDC_VERSION} /app && \ | ||
cd .. && \ | ||
rm -rf build && \ | ||
cd /app && \ | ||
sed -i '/pyinstaller/d' requirements.txt && \ | ||
cat requirements.txt && \ | ||
pip install --no-cache-dir -r requirements.txt && \ | ||
apt-get purge -y wget | ||
|
||
VOLUME /app/data | ||
WORKDIR /app | ||
cd /tmp/src && \ | ||
/pyinstaller/pyinstaller.sh \ | ||
--onefile Movie_Data_Capture.py \ | ||
--hidden-import ADC_function.py \ | ||
--hidden-import core.py \ | ||
--add-data "Img:Img" \ | ||
--add-data "$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1):cloudscraper" \ | ||
--add-data "$(python -c 'import opencc as _; print(_.__path__[0])' | tail -n 1):opencc" | ||
|
||
COPY docker-entrypoint.sh docker-entrypoint.sh | ||
FROM vergilgao/alpine | ||
RUN apk --update --no-cache add \ | ||
libxcb | ||
|
||
# 镜像版本号 | ||
ARG BUILD_DATE | ||
LABEL build_version="catfight360.com mdc-version:- ${MDC_VERSION} build-date:- ${BUILD_DATE}" | ||
COPY --from=build-stage /tmp/src/dist/Movie_Data_Capture /app | ||
COPY docker-entrypoint.sh docker-entrypoint.sh | ||
|
||
RUN chmod +x docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["./docker-entrypoint.sh"] | ||
ENTRYPOINT ["/docker-entrypoint.sh"] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
# From http://wiki.musl-libc.org/wiki/FAQ#Q:_where_is_ldd_.3F | ||
# | ||
# Musl's dynlinker comes with ldd functionality built in. just create a | ||
# symlink from ld-musl-$ARCH.so to /bin/ldd. If the dynlinker was started | ||
# as "ldd", it will detect that and print the appropriate DSO information. | ||
# | ||
# Instead, this string replaced "ldd" with the package so that pyinstaller | ||
# can find the actual lib. | ||
exec /usr/bin/ldd "$@" | \ | ||
sed -r 's/([^[:space:]]+) => ldd/\1 => \/lib\/\1/g' | \ | ||
sed -r 's/ldd \(.*\)//g' |
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,10 @@ | ||
#!/bin/sh | ||
# Simple wrapper around pyinstaller | ||
|
||
set -e | ||
|
||
# Use the hacked ldd to fix libc.musl-x86_64.so.1 location | ||
PATH="/pyinstaller:$PATH" | ||
|
||
# Exclude pycrypto and PyInstaller from built packages | ||
exec pyinstaller "$@" |