Files
Anthias/docker/Dockerfile.test.j2
Viktor Petersson cd42c76bc8 feat: replace Selenium with Playwright and fix Docker multi-stage builds
- Replace selenium/splinter with playwright/pytest-playwright for integration tests
- Rewrite all 12 integration tests using Playwright sync API + live_server fixture
- All tests now pass (previously many were skipped)
- Fix Docker apt cache lock conflicts by removing cache mounts from deps stage
- Install Playwright browsers at /opt/playwright in test Dockerfile
- Remove Chrome/ChromeDriver download logic from image builder
- Fix inactive table missing data-asset-id attributes
- Fix streaming mimetype detection order (rtsp:// checked before .mov extension)
- Change URI input from type="url" to type="text" to support rtsp:// protocols

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:46:44 +00:00

57 lines
1.5 KiB
Django/Jinja

{% include 'Dockerfile.base.j2' %}
COPY pyproject.toml uv.lock /tmp/uv-deps/
{% if disable_cache_mounts %}
RUN \
{% else %}
RUN --mount=type=cache,target=/root/.cache/uv \
{% endif %}
cd /tmp/uv-deps && \
uv venv /opt/venv && \
VIRTUAL_ENV=/opt/venv uv sync --active --only-group test --no-install-project --frozen
# Runtime stage
FROM {{ base_image }}:{{ base_image_tag }}
ENV DEBIAN_FRONTEND=noninteractive
{% if disable_cache_mounts %}
RUN \
{% else %}
RUN --mount=type=cache,target=/var/cache/apt \
{% endif %}
apt-get update && \
apt-get -y install --no-install-recommends \
{% for dependency in base_apt_dependencies %}
{% if not loop.last %}
{{ dependency }} \
{% else %}
{{ dependency }}
{% endif %}
{% endfor %}
# Works around issue with `curl`
# https://github.com/balena-io-library/base-images/issues/562
RUN c_rehash
# Copy Python 3.13 and venv from deps stage
COPY --from=deps /opt/python /opt/python
COPY --from=deps /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install Playwright browsers and OS dependencies
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
RUN playwright install --with-deps chromium
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 }}