ucast/deploy/Dockerfile
2022-07-05 14:53:08 +02:00

48 lines
1.4 KiB
Docker

FROM registry.hub.docker.com/thetadev256/ucast-dev
COPY . /build
WORKDIR /build
RUN poetry build -f wheel
FROM registry.hub.docker.com/library/python:3.10
ARG TARGETPLATFORM
# ffmpeg static source (https://johnvansickle.com/ffmpeg/)
RUN set -e; \
mkdir /build_ffmpeg; \
cd /build_ffmpeg; \
case "$TARGETPLATFORM" in \
"linux/amd64") ffmpeg_arch="amd64";; \
"linux/arm64") ffmpeg_arch="arm64";; \
"linux/arm/v7") ffmpeg_arch="armhf";; \
*) echo "TARGETPLATFORM $TARGETPLATFORM not found"; exit 1 ;;\
esac; \
wget "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${ffmpeg_arch}-static.tar.xz"; \
wget "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${ffmpeg_arch}-static.tar.xz.md5"; \
md5sum -c "ffmpeg-release-${ffmpeg_arch}-static.tar.xz.md5"; \
tar Jxf "ffmpeg-release-${ffmpeg_arch}-static.tar.xz"; \
mv "ffmpeg-5.0.1-${ffmpeg_arch}-static/ffmpeg" /usr/bin; \
cd /; \
rm -rf /build_ffmpeg;
# nginx
RUN apt-get update && \
apt-get install -y nginx && \
apt-get clean && \
mkdir /ucast && \
chown 1000:1000 /ucast && \
chown -R 1000:1000 /var/lib/nginx /var/log/nginx
COPY ./deploy/nginx.conf /etc/nginx/nginx.conf
COPY ./deploy/nginx /etc/nginx/conf.d
COPY ./deploy/entrypoint.py /entrypoint.py
COPY --from=0 /build/dist /install
RUN pip install -- /install/*.whl gunicorn honcho && \
rm -rf ~/.cache/pip
ENV UCAST_WORKDIR=/ucast
EXPOSE 8001
ENTRYPOINT /entrypoint.py