Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions RemoteSettings.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ WORKDIR /opt
COPY ./uv.lock ./pyproject.toml ./
COPY ./kinto-slack ./kinto-slack
RUN uv venv $VIRTUAL_ENV
RUN uv sync --frozen --no-install-project --no-editable \
RUN uv sync --frozen --compile-bytecode --no-install-project --no-editable \
--no-group kinto-remote-settings \
--no-group cronjobs \
--no-group git-reader \
--no-group dev \
--no-group docs

COPY ./kinto-remote-settings ./kinto-remote-settings
RUN uv sync --frozen --no-install-project --no-editable \
RUN uv sync --frozen --compile-bytecode --no-install-project --no-editable \
--group kinto-remote-settings \
--no-group cronjobs \
--no-group git-reader \
Expand Down Expand Up @@ -78,6 +78,9 @@ COPY --chown=app:app . .

COPY --from=get-admin /opt/kinto-admin/build $KINTO_ADMIN_ASSETS_PATH

# Compile app bytecode to speed up startup time.
RUN python -m compileall -q /app

# Generate local key pair to simplify running without Autograph out of the box (see `config/testing.ini`)
RUN python -m kinto_remote_settings.signer.generate_keypair /app/ecdsa.private.pem /app/ecdsa.public.pem

Expand Down
4 changes: 3 additions & 1 deletion git-reader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ RUN mkdir /app/.ssh && \
COPY --chown=app:app pyproject.toml uv.lock ./
COPY --chown=app:app version.json .

RUN uv sync --frozen --no-install-project
RUN uv sync --frozen --compile-bytecode --no-install-project

COPY --chown=app:app run.sh .
RUN chmod +x run.sh
COPY --chown=app:app app.py mimetypes.txt ./
# Compile app bytecode to speed up startup time.
RUN python -m compileall -q /app

USER app

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from typing import Any
from urllib.parse import urlparse

import cryptography
import cryptography.x509
from cryptography.hazmat.backends import default_backend as crypto_default_backend
from kinto.core.events import ACTIONS
from kinto.core.storage.exceptions import UnicityError
from kinto.core.utils import build_request, instance_uri, read_env
Expand Down Expand Up @@ -309,6 +306,13 @@ def fetch_cert(url):
"""
Returns the SSL certificate object for the specified `url`.
"""
# Import lazily to reduce startup time for the application
# since cryptography is a heavy dependency (200ms import time!)
# and `fetch_cert()` is only used in healthcheck.
import cryptography
import cryptography.x509
from cryptography.hazmat.backends import default_backend as crypto_default_backend

parsed_url = urlparse(url)
host, port = (parsed_url.netloc, parsed_url.port or 443)
cert_pem = ssl.get_server_certificate((host, port))
Expand Down
Loading