Files
Anthias/docker/Dockerfile.server.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

55 lines
1.4 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 server --no-install-project --frozen
# Runtime stage
FROM {{ base_image }}:{{ base_image_tag }}
{% 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"
# Create non-root user
RUN groupadd -r anthias && useradd -r -g anthias -d /data -s /bin/bash anthias
RUN mkdir -p /data /usr/src/app && chown -R anthias:anthias /data
WORKDIR /usr/src/app
COPY --chown=anthias:anthias . /usr/src/app/
ENV GIT_HASH={{ git_hash }}
ENV GIT_SHORT_HASH={{ git_short_hash }}
ENV GIT_BRANCH={{ git_branch }}
ENV DEVICE_TYPE={{ board }}
USER anthias
CMD ["bash", "bin/start_server.sh"]