mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 22:16:37 +00:00
commit
d699b5c453
103
Dockerfile
103
Dockerfile
@ -20,6 +20,36 @@ ARG FFMPEG_CHECKSUM_ALGORITHM="sha256"
|
|||||||
ARG S6_CHECKSUM_ALGORITHM="sha256"
|
ARG S6_CHECKSUM_ALGORITHM="sha256"
|
||||||
|
|
||||||
|
|
||||||
|
FROM debian:${DEBIAN_VERSION} AS tubesync-base
|
||||||
|
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND="noninteractive" \
|
||||||
|
HOME="/root" \
|
||||||
|
LANGUAGE="en_US.UTF-8" \
|
||||||
|
LANG="en_US.UTF-8" \
|
||||||
|
LC_ALL="en_US.UTF-8" \
|
||||||
|
TERM="xterm" \
|
||||||
|
# Do not include compiled byte-code
|
||||||
|
PIP_NO_COMPILE=1 \
|
||||||
|
PIP_ROOT_USER_ACTION='ignore'
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \
|
||||||
|
--mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \
|
||||||
|
# to be careful, ensure that these files aren't from a different architecture
|
||||||
|
rm -f /var/cache/apt/*cache.bin ; \
|
||||||
|
# Update from the network and keep cache
|
||||||
|
rm -f /etc/apt/apt.conf.d/docker-clean ; \
|
||||||
|
set -x && \
|
||||||
|
apt-get update && \
|
||||||
|
# Install locales
|
||||||
|
apt-get -y --no-install-recommends install locales && \
|
||||||
|
printf -- "en_US.UTF-8 UTF-8\n" > /etc/locale.gen && \
|
||||||
|
locale-gen en_US.UTF-8 && \
|
||||||
|
# Clean up
|
||||||
|
apt-get -y autopurge && \
|
||||||
|
apt-get -y autoclean
|
||||||
|
|
||||||
FROM alpine:${ALPINE_VERSION} AS ffmpeg-download
|
FROM alpine:${ALPINE_VERSION} AS ffmpeg-download
|
||||||
ARG FFMPEG_DATE
|
ARG FFMPEG_DATE
|
||||||
ARG FFMPEG_VERSION
|
ARG FFMPEG_VERSION
|
||||||
@ -218,52 +248,24 @@ RUN set -eu ; \
|
|||||||
FROM scratch AS s6-overlay
|
FROM scratch AS s6-overlay
|
||||||
COPY --from=s6-overlay-extracted /s6-overlay-rootfs /
|
COPY --from=s6-overlay-extracted /s6-overlay-rootfs /
|
||||||
|
|
||||||
FROM debian:${DEBIAN_VERSION} AS tubesync
|
FROM tubesync-base AS tubesync
|
||||||
|
|
||||||
ARG S6_VERSION
|
ARG S6_VERSION
|
||||||
|
|
||||||
ARG FFMPEG_DATE
|
ARG FFMPEG_DATE
|
||||||
ARG FFMPEG_VERSION
|
ARG FFMPEG_VERSION
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
ARG TARGETARCH
|
||||||
HOME="/root" \
|
|
||||||
LANGUAGE="en_US.UTF-8" \
|
|
||||||
LANG="en_US.UTF-8" \
|
|
||||||
LC_ALL="en_US.UTF-8" \
|
|
||||||
TERM="xterm" \
|
|
||||||
# Do not include compiled byte-code
|
|
||||||
PIP_NO_COMPILE=1 \
|
|
||||||
PIP_ROOT_USER_ACTION='ignore' \
|
|
||||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
|
|
||||||
|
|
||||||
ENV S6_VERSION="${S6_VERSION}" \
|
ENV S6_VERSION="${S6_VERSION}" \
|
||||||
FFMPEG_DATE="${FFMPEG_DATE}" \
|
FFMPEG_DATE="${FFMPEG_DATE}" \
|
||||||
FFMPEG_VERSION="${FFMPEG_VERSION}"
|
FFMPEG_VERSION="${FFMPEG_VERSION}"
|
||||||
|
|
||||||
# Install third party software
|
|
||||||
COPY --from=s6-overlay / /
|
|
||||||
COPY --from=ffmpeg /usr/local/bin/ /usr/local/bin/
|
|
||||||
|
|
||||||
# Reminder: the SHELL handles all variables
|
# Reminder: the SHELL handles all variables
|
||||||
RUN --mount=type=cache,id=apt-lib-cache,sharing=locked,target=/var/lib/apt \
|
RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \
|
||||||
--mount=type=cache,id=apt-cache-cache,sharing=locked,target=/var/cache/apt \
|
--mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \
|
||||||
set -x && \
|
set -x && \
|
||||||
# Update from the network and keep cache
|
|
||||||
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
# Install locales
|
|
||||||
apt-get -y --no-install-recommends install locales && \
|
|
||||||
printf -- "en_US.UTF-8 UTF-8\n" > /etc/locale.gen && \
|
|
||||||
locale-gen en_US.UTF-8 && \
|
|
||||||
# Install file
|
|
||||||
apt-get -y --no-install-recommends install file && \
|
|
||||||
# Installed s6 (using COPY earlier)
|
|
||||||
file -L /command/s6-overlay-suexec && \
|
|
||||||
# Installed ffmpeg (using COPY earlier)
|
|
||||||
/usr/local/bin/ffmpeg -version && \
|
|
||||||
file /usr/local/bin/ff* && \
|
|
||||||
# Clean up file
|
|
||||||
apt-get -y autoremove --purge file && \
|
|
||||||
# Install dependencies we keep
|
# Install dependencies we keep
|
||||||
# Install required distro packages
|
# Install required distro packages
|
||||||
apt-get -y --no-install-recommends install \
|
apt-get -y --no-install-recommends install \
|
||||||
@ -283,10 +285,33 @@ RUN --mount=type=cache,id=apt-lib-cache,sharing=locked,target=/var/lib/apt \
|
|||||||
&& \
|
&& \
|
||||||
# Link to the current python3 version
|
# Link to the current python3 version
|
||||||
ln -v -s -f -T "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" /usr/local/lib/python3 && \
|
ln -v -s -f -T "$(find /usr/local/lib -name 'python3.[0-9]*' -type d -printf '%P\n' | sort -r -V | head -n 1)" /usr/local/lib/python3 && \
|
||||||
|
# Create a 'app' user which the application will run as
|
||||||
|
groupadd app && \
|
||||||
|
useradd -M -d /app -s /bin/false -g app app && \
|
||||||
# Clean up
|
# Clean up
|
||||||
apt-get -y autopurge && \
|
apt-get -y autopurge && \
|
||||||
apt-get -y autoclean && \
|
apt-get -y autoclean
|
||||||
rm -rf /tmp/*
|
|
||||||
|
# Install third party software
|
||||||
|
COPY --from=s6-overlay / /
|
||||||
|
COPY --from=ffmpeg /usr/local/bin/ /usr/local/bin/
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \
|
||||||
|
--mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \
|
||||||
|
set -x && \
|
||||||
|
apt-get update && \
|
||||||
|
# Install file
|
||||||
|
apt-get -y --no-install-recommends install file && \
|
||||||
|
# Installed s6 (using COPY earlier)
|
||||||
|
file -L /command/s6-overlay-suexec && \
|
||||||
|
# Installed ffmpeg (using COPY earlier)
|
||||||
|
/usr/local/bin/ffmpeg -version && \
|
||||||
|
file /usr/local/bin/ff* && \
|
||||||
|
# Clean up file
|
||||||
|
apt-get -y autoremove --purge file && \
|
||||||
|
# Clean up
|
||||||
|
apt-get -y autopurge && \
|
||||||
|
apt-get -y autoclean
|
||||||
|
|
||||||
# Copy over pip.conf to use piwheels
|
# Copy over pip.conf to use piwheels
|
||||||
COPY pip.conf /etc/pip.conf
|
COPY pip.conf /etc/pip.conf
|
||||||
@ -297,12 +322,10 @@ WORKDIR /app
|
|||||||
# Set up the app
|
# Set up the app
|
||||||
RUN --mount=type=tmpfs,target=/cache \
|
RUN --mount=type=tmpfs,target=/cache \
|
||||||
--mount=type=cache,id=pipenv-cache,sharing=locked,target=/cache/pipenv \
|
--mount=type=cache,id=pipenv-cache,sharing=locked,target=/cache/pipenv \
|
||||||
--mount=type=cache,id=apt-lib-cache,sharing=locked,target=/var/lib/apt \
|
--mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \
|
||||||
--mount=type=cache,id=apt-cache-cache,sharing=locked,target=/var/cache/apt \
|
--mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \
|
||||||
--mount=type=bind,source=Pipfile,target=/app/Pipfile \
|
--mount=type=bind,source=Pipfile,target=/app/Pipfile \
|
||||||
set -x && \
|
set -x && \
|
||||||
# Update from the network and keep cache
|
|
||||||
rm -f /etc/apt/apt.conf.d/docker-clean && \
|
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
# Install required build packages
|
# Install required build packages
|
||||||
apt-get -y --no-install-recommends install \
|
apt-get -y --no-install-recommends install \
|
||||||
@ -318,9 +341,6 @@ RUN --mount=type=tmpfs,target=/cache \
|
|||||||
python3-pip \
|
python3-pip \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
&& \
|
&& \
|
||||||
# Create a 'app' user which the application will run as
|
|
||||||
groupadd app && \
|
|
||||||
useradd -M -d /app -s /bin/false -g app app && \
|
|
||||||
# Install non-distro packages
|
# Install non-distro packages
|
||||||
cp -at /tmp/ "${HOME}" && \
|
cp -at /tmp/ "${HOME}" && \
|
||||||
HOME="/tmp/${HOME#/}" \
|
HOME="/tmp/${HOME#/}" \
|
||||||
@ -388,6 +408,7 @@ HEALTHCHECK --interval=1m --timeout=10s --start-period=3m CMD ["/app/healthcheck
|
|||||||
# ENVS and ports
|
# ENVS and ports
|
||||||
ENV PYTHONPATH="/app" \
|
ENV PYTHONPATH="/app" \
|
||||||
PYTHONPYCACHEPREFIX="/config/cache/pycache" \
|
PYTHONPYCACHEPREFIX="/config/cache/pycache" \
|
||||||
|
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
|
||||||
XDG_CACHE_HOME="/config/cache"
|
XDG_CACHE_HOME="/config/cache"
|
||||||
EXPOSE 4848
|
EXPOSE 4848
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user