Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
基础镜像迁移至 debian
Browse files Browse the repository at this point in the history
  • Loading branch information
VergilGao committed May 23, 2023
1 parent 8a479db commit 6eea13f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 138 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/build-baseimage.yml

This file was deleted.

64 changes: 39 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
FROM ghcr.io/vergilgao/mdc-buildimage:dev as build-stage
FROM python:3.10-slim-bullseye as build-stage

RUN \
apt-get -y update && apt-get -y upgrade \
&& apt install -y -q \
bash \
wget \
binutils \
upx \
&& apt-get autoremove --purge -y \
&& apt-get clean -y

ARG MDC_SOURCE_VERSION
ENV MDC_SOURCE_VERSION=${MDC_SOURCE_VERSION:-916dbd6abcc16575f8745acc33f9dab1e956d85d}
ENV MDC_SOURCE_VERSION=${MDC_SOURCE_VERSION:-0e7f7f497e49ae9c2dd776357892a1f1cd6d6068}

RUN mkdir -p /tmp/mdc && cd /tmp/mdc && \
RUN mkdir -p /tmp/mdc && cd /tmp/mdc \
# get mdc source code
wget -O- https://github.com/yoshiko2/Movie_Data_Capture/archive/$MDC_SOURCE_VERSION.tar.gz | tar xz -C /tmp/mdc --strip-components 1 && \
# fix dowload error
sed -i "s/if configProxy:/if configProxy.enable:/g" core.py && \
# build mdc
/pyinstaller/pyinstaller.sh \
--onefile Movie_Data_Capture.py \
&& wget -O- https://github.com/yoshiko2/Movie_Data_Capture/archive/$MDC_SOURCE_VERSION.tar.gz | tar xz -C /tmp/mdc --strip-components 1 \
&& python3 -m venv /opt/venv && . /opt/venv/bin/activate \
&& pip install --upgrade \
pip \
pyinstaller \
&& pip install -r requirements.txt \
&& pip install face_recognition --no-deps \
&& pyinstaller \
-D Movie_Data_Capture.py \
--python-option u \
--hidden-import "ImageProcessing.cnn" \
--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" \
--add-data "$(python -c 'import face_recognition_models as _; print(_.__path__[0])' | tail -n 1):face_recognition_models"

FROM ghcr.io/vergilgao/alpine-baseimage
--add-data "$(python -c 'import face_recognition_models as _; print(_.__path__[0])' | tail -n 1):face_recognition_models" \
--add-data "Img:Img" \
--add-data "scrapinglib:scrapinglib" \
&& cp /tmp/mdc/config.ini /tmp/mdc/dist/Movie_Data_Capture/config.template

RUN apk --update --no-cache add \
libxcb
FROM debian:11-slim

ARG BUILD_DATE
ARG VERSION
Expand All @@ -36,17 +49,18 @@ ENV GID=100
ENV UMASK=002

ADD docker-entrypoint.sh docker-entrypoint.sh

RUN chmod +x docker-entrypoint.sh && \
mkdir -p /app && \
mkdir -p /data && \
mkdir -p /config && \
useradd -d /config -s /bin/sh mdc && \
chown -R mdc /config && \
chown -R mdc /data

COPY --from=build-stage /tmp/mdc/dist/Movie_Data_Capture /app
COPY --from=build-stage /tmp/mdc/config.ini /app/config.template

RUN \
apt-get -y update && apt-get -y upgrade \
&& apt install -y -q \
gosu \
&& apt-get autoremove --purge -y \
&& apt-get clean -y \
&& chmod +x docker-entrypoint.sh \
&& mkdir -p /data /config \
&& useradd -d /config -s /bin/sh mdc \
&& chown -R mdc /data /config

VOLUME [ "/data", "/config" ]

Expand Down
49 changes: 0 additions & 49 deletions build-stage/Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ ! -d /config ]; then
echo "---no config folder found, create...---"
mkdir -p /config
fi
chown -R ${UID}:${GID} /app /data /config
chown -R ${UID}:${GID} /data /config

echo "Checking if config file exist"
if [ ! -f "${config_file}" ]; then
Expand All @@ -30,4 +30,4 @@ fi

echo "Starting..."
cd /data
gosu ${USER} /app/Movie_Data_Capture "$@"
gosu ${USER} /app/Movie_Data_Capture
13 changes: 0 additions & 13 deletions root/ldd

This file was deleted.

10 changes: 0 additions & 10 deletions root/pyinstaller.sh

This file was deleted.

0 comments on commit 6eea13f

Please sign in to comment.