Skip to content
Snippets Groups Projects
Verified Commit 037963b9 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

swh-counters: Add dockerfile

Refs. swh/infra/sysadm-environment#5179
parent 0a2c2ccb
No related branches found
No related tags found
No related merge requests found
# Deeply inspired from the Dockerfile of the swh-storage project
FROM python:3.10-bullseye
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get install -y libcmph-dev librdkafka-dev && \
apt clean && \
addgroup --gid 1000 swh && \
useradd --gid 1000 --uid 1000 -m -d /opt/swh swh && \
mkdir /etc/swh
USER swh
WORKDIR /opt/swh
COPY --chown=swh:swh requirements-frozen.txt /opt/swh
ENV PYTHONPATH=/opt/swh
ENV PATH=/opt/swh/.local/bin:$PATH
RUN /usr/local/bin/python -m pip install --upgrade pip && \
pip install --no-cache-dir -r requirements-frozen.txt && \
pip install gunicorn
COPY --chown=swh:swh entrypoint.sh /opt/swh
RUN chmod u+x /opt/swh/entrypoint.sh
ENV SWH_CONFIG_FILENAME=/etc/swh/config.yml
ENV PORT 5011
EXPOSE $PORT
ENV LOG_LEVEL INFO
ENV THREADS 2
ENV WORKERS 2
ENV TIMEOUT 3600
ENTRYPOINT ["/opt/swh/entrypoint.sh"]
#!/bin/bash
set -e
case "$1" in
"shell")
shift
if (( $# == 0)); then
exec bash -i
else
"$@"
fi
;;
"swh")
shift
echo "Running swh command $@"
exec swh $@
;;
*)
echo Starting the swh-search API server
exec gunicorn --bind 0.0.0.0:${PORT} \
--log-level ${LOG_LEVEL} \
--threads ${THREADS} \
--workers ${WORKERS} \
--reload \
--timeout ${TIMEOUT} \
--config 'python:swh.core.api.gunicorn_config' \
'swh.counters.api.server:make_app_from_configfile()'
esac
swh.counters
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment