Files
Anthias/docker/Dockerfile.test.j2
2025-09-05 19:03:39 -07:00

75 lines
2.1 KiB
Django/Jinja

{% include 'Dockerfile.base.j2' %}
# vim: ft=dockerfile
# @TODO: Uncomment this build stage when test_add_asset_streaming is fixed.
# FROM debian:buster as builder
# RUN apt-get update && \
# apt-get -y install --no-install-recommends \
# build-essential \
# git \
# ca-certificates && \
# apt-get clean
# RUN cd /opt && \
# git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg && \
# cd ffmpeg && \
# git checkout 2ca65fc7b74444edd51d5803a2c1e05a801a6023 && \
# ./configure --disable-x86asm && make -j$(nproc) --quiet
ENV DEBIAN_FRONTEND noninteractive
{% if disable_cache_mounts %}
RUN \
{% else %}
RUN --mount=type=cache,target=/var/cache/apt \
{% endif %}
apt-get -y install \
{% for dependency in apt_dependencies %}
{% if not loop.last %}
{{ dependency }} \
{% else %}
{{ dependency }}
{% endif %}
{% endfor %}
{% include 'nodejs-install.j2' %}
# @TODO: Uncomment the lines below when test_add_asset_streaming is fixed.
# WORKDIR /opt/ffmpeg
# COPY --from=builder /opt/ffmpeg/ffserver ./
ADD requirements/requirements.txt /tmp/requirements.txt
ADD requirements/requirements.dev.txt /tmp/requirements.dev.txt
ADD requirements/requirements.viewer.txt /tmp/requirements.viewer.txt
RUN wget {{ chromedriver_dl_url }} -O /tmp/chromedriver.zip && \
unzip -o /tmp/chromedriver.zip -d /opt
RUN wget {{ chrome_dl_url }} -O /tmp/chrome.zip && \
unzip -o /tmp/chrome.zip -d /opt
{% if disable_cache_mounts %}
RUN \
{% else %}
RUN --mount=type=cache,target=/root/.cache/pip \
{% endif %}
pip3 install \
-r /tmp/requirements.txt \
-r /tmp/requirements.dev.txt \
-r /tmp/requirements.viewer.txt \
--break-system-packages
RUN mkdir -p /usr/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN mkdir -p /data/.screenly /data/screenly_assets
RUN cp ansible/roles/screenly/files/screenly.conf \
/data/.screenly
ENV GIT_HASH={{ git_hash }}
ENV GIT_SHORT_HASH={{ git_short_hash }}
ENV GIT_BRANCH={{ git_branch }}
ENV PATH="/opt/chrome-linux64:/opt/chromedriver-linux64:$PATH"