Skip to content
Snippets Groups Projects
Unverified Commit 038eb88e authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

counters: Install python dependencies faster

parent 3156ddbd
No related branches found
Tags swh-loader-highpriority-20220926.1
No related merge requests found
# Deeply inspired from the Dockerfile of the swh-storage project
FROM python:3.10-bullseye
ARG userid=1000
ARG groupid=1000
ARG user=swh
ARG workdir=/opt/${user}
ARG venv=${workdir}/venv
ARG configdir=/etc/${user}
# retry command is used by the refresh-history cron job
# to ensure the rpc service is well up
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get install -y libcmph-dev librdkafka-dev retry && \
apt clean && \
addgroup --gid 1000 swh && \
useradd --gid 1000 --uid 1000 -m -d /opt/swh swh && \
mkdir /etc/swh
USER swh
WORKDIR /opt/swh
addgroup --gid ${userid} ${user} && \
useradd --gid ${groupid} --uid ${userid} -m -d ${workdir} ${user} && \
mkdir ${configdir}
COPY --chown=swh:swh requirements-frozen.txt /opt/swh
USER ${user}
RUN python -m venv ${venv}
WORKDIR ${workdir}
ENV PYTHONPATH=/opt/swh
ENV PATH=/opt/swh/.local/bin:$PATH
ENV PYTHONPATH=${venv}
ENV PATH=${venv}/bin:$PATH
RUN /usr/local/bin/python -m pip install --upgrade pip && \
pip install --no-cache-dir -r requirements-frozen.txt
RUN python -m pip install uv
COPY --chown=${userid}:${groupid} requirements-frozen.txt ${workdir}
RUN uv pip sync --no-cache requirements-frozen.txt
COPY --chown=swh:swh entrypoint.sh /opt/swh
RUN chmod u+x /opt/swh/entrypoint.sh
COPY --chown=${userid}:${groupid} entrypoint.sh ${workdir}
RUN chmod u+x ${workdir}/entrypoint.sh
ENV SWH_CONFIG_FILENAME=/etc/swh/config.yml
ENV SWH_CONFIG_FILENAME=${configdir}/config.yml
ENV PORT 5011
EXPOSE $PORT
ENV THREADS 2
......
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