diff --git a/.gitignore b/.gitignore index e7e73c6..4ed9e92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ media_files/encoded/ media_files/original/ media_files/hls/ +media_files/chunks/ +media_files/uploads/ postgres_data/ celerybeat-schedule logs/ diff --git a/Dockerfile b/Dockerfile index 561b4c3..96e4a45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,12 +16,12 @@ RUN pip install -r requirements.txt COPY . /home/mediacms.io/mediacms WORKDIR /home/mediacms.io/mediacms -RUN wget -q http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip && \ - unzip Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip -d ../bento4 && \ - mv ../bento4/Bento4-SDK-1-6-0-632.x86_64-unknown-linux/* ../bento4/ && \ - rm -rf ../bento4/Bento4-SDK-1-6-0-632.x86_64-unknown-linux && \ +RUN wget -q http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip && \ + unzip Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip -d ../bento4 && \ + mv ../bento4/Bento4-SDK-1-6-0-637.x86_64-unknown-linux/* ../bento4/ && \ + rm -rf ../bento4/Bento4-SDK-1-6-0-637.x86_64-unknown-linux && \ rm -rf ../bento4/docs && \ - rm Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip + rm Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip ############ RUNTIME IMAGE ############ FROM python:3.8-slim-buster as runtime-image @@ -47,7 +47,7 @@ ENV ENABLE_MIGRATIONS='yes' ENV VIRTUAL_ENV=/home/mediacms.io ENV PATH="$VIRTUAL_ENV/bin:$PATH" -COPY --from=compile-image /home/mediacms.io /home/mediacms.io +COPY --chown=www-data:www-data --from=compile-image /home/mediacms.io /home/mediacms.io RUN apt-get update -y && apt-get -y upgrade && apt-get install --no-install-recommends \ supervisor nginx ffmpeg imagemagick procps -y && \ diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh index 1225b51..f832577 100755 --- a/deploy/docker/entrypoint.sh +++ b/deploy/docker/entrypoint.sh @@ -4,6 +4,7 @@ set -e # forward request and error logs to docker log collector ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && \ ln -sf /dev/stdout /var/log/nginx/mediacms.io.access.log && ln -sf /dev/stderr /var/log/nginx/mediacms.io.error.log + cp /home/mediacms.io/mediacms/deploy/docker/local_settings.py /home/mediacms.io/mediacms/cms/local_settings.py mkdir -p /home/mediacms.io/mediacms/{logs,pids,media_files/hls} @@ -12,8 +13,6 @@ touch /home/mediacms.io/mediacms/logs/debug.log # Remove any dangling pids rm -rf /home/mediacms.io/mediacms/pids/* -chown -R www-data. /home/mediacms.io/ - TARGET_GID=$(stat -c "%g" /home/mediacms.io/mediacms/) EXISTS=$(cat /etc/group | grep $TARGET_GID | wc -l) @@ -28,6 +27,9 @@ else usermod -a -G $GROUP www-data fi +# We should do this only for folders that have a different owner, since it is an expensive operation +find /home/mediacms.io/ ! \( -user www-data -group $TARGET_GID \) -exec chown www-data:$TARGET_GID {} + + chmod +x /home/mediacms.io/mediacms/deploy/docker/start.sh /home/mediacms.io/mediacms/deploy/docker/prestart.sh exec "$@" diff --git a/install.sh b/install.sh index d6a7ef9..53d3d40 100644 --- a/install.sh +++ b/install.sh @@ -115,8 +115,8 @@ fi # Bento4 utility installation, for HLS cd /home/mediacms.io/mediacms -wget http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip -unzip Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip +wget http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip +unzip Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip mkdir /home/mediacms.io/mediacms/media_files/hls # last, set default owner