github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/results-processor/Dockerfile (about)

     1  FROM python:3.9.19-bullseye
     2  
     3  # Install runtime dependencies.
     4  # python3-crcmod for faster gsutil checksum
     5  # python3-virtualenv for virtualenv
     6  # https://cloud.google.com/storage/docs/gsutil/commands/rsync#slow-checksums
     7  RUN apt-get update -q && apt-get install -qy python3-crcmod python3-virtualenv  && apt-get clean
     8  # gcloud SDK
     9  RUN curl -s https://sdk.cloud.google.com > install-gcloud.sh
    10  RUN bash install-gcloud.sh --disable-prompts --install-dir=/opt > /dev/null
    11  ENV PATH=/opt/google-cloud-sdk/bin:$PATH
    12  RUN gcloud config set disable_usage_reporting false
    13  # This file caches whether we are running on GCE. When created during the image
    14  # building process, the file says False (because images aren't built on GCE),
    15  # which makes gcloud & gsutil fail to use the default service account in this
    16  # container until the cache expires (~5 minutes).
    17  RUN rm -f $HOME/.config/gcloud/gce
    18  
    19  # Setup and activate virtualenv.
    20  RUN virtualenv -p python3.9 /env
    21  ENV VIRTUAL_ENV /env
    22  ENV PATH /env/bin:$PATH
    23  
    24  # WORKDIR needs to be set explicitly to /app
    25  WORKDIR /app
    26  
    27  # Install Python dependencies.
    28  ADD requirements.txt /app/
    29  RUN pip install -r requirements.txt
    30  
    31  ADD . /app/
    32  # The number of workers should always be 2: one for processing tasks, the other
    33  # for responding health checks. Scale the service by increasing the number of
    34  # instances instead.
    35  # The timeout for gunicorn should be significantly longer than the timeout in
    36  # main.py for liveness checks, because when things go wrong we'd like AppEngine
    37  # to restart a fresh Docker instance instead of having gunicorn to restart the
    38  # worker (which would require extra cleanup/recovery logic).
    39  CMD exec gunicorn --bind :$PORT --timeout 7200 --workers 2 main:app