Dockerfile
Rama master · réplica de lectura del repositorio original.
# Install npm packages
FROM node:10.17.0-alpine AS npm
WORKDIR /code
COPY ./static/package*.json /code/static/
RUN cd /code/static && npm ci
FROM --platform=linux/amd64 ubuntu:22.04
ARG UV_VERSION="0.10.12"
ARG UV_HASH="ec72570c9d1f33021aa80b176d7baba390de2cfeb1abcbefca346d563bf17484"
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Precompile installed dependencies to .pyc so containers don't compile them on every start
ENV UV_COMPILE_BYTECODE=1
# Install the managed Python outside /root so a non-root SL_UID can execute it
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
WORKDIR /code
# Copy dependency files
COPY pyproject.toml uv.lock .python-version ./
# Install deps
RUN apt-get update \
&& apt-get install -y curl netcat-traditional gcc python3-dev gnupg git libre2-dev build-essential pkg-config cmake ninja-build bash clang \
&& curl -sSL "https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-x86_64-unknown-linux-gnu.tar.gz" > uv.tar.gz \
&& echo "${UV_HASH} uv.tar.gz" | sha256sum -c - \
&& tar xf uv.tar.gz -C /tmp/ \
&& mv /tmp/uv-x86_64-unknown-linux-gnu/uv /usr/bin/uv \
&& mv /tmp/uv-x86_64-unknown-linux-gnu/uvx /usr/bin/uvx \
&& rm -rf /tmp/uv* \
&& rm -f uv.tar.gz \
&& uv python install `cat .python-version` \
&& export CMAKE_POLICY_VERSION_MINIMUM=3.5 \
&& uv sync --locked \
&& apt-get autoremove -y \
&& apt-get purge -y curl netcat-traditional build-essential pkg-config cmake ninja-build python3-dev clang\
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Generate flanker's PLY parser tables (*_parsetab.py) at build time. Otherwise flanker
# tries to write them into site-packages on every start.
RUN /code/.venv/bin/python -c "import compileall, os, flanker.addresslib._parser.parser as p; compileall.compile_dir(os.path.dirname(p.__file__), quiet=1)"
# Copy code
COPY . .
# copy npm packages
COPY --from=npm /code /code
ENV PATH="/code/.venv/bin:$PATH"
# Precompile application code (.venv is already compiled by uv sync)
RUN python -m compileall -q -j 0 -x '/code/(\.venv|static)/' /code
EXPOSE 7777
# Runs as root unless SL_UID (and optionally SL_GID) is set, in which case the
# command is executed as that UID/GID
ENTRYPOINT ["/code/scripts/docker-entrypoint.sh"]
#gunicorn wsgi:app -b 0.0.0.0:7777 -w 2 --timeout 15 --log-level DEBUG
CMD ["gunicorn","wsgi:app","-b","0.0.0.0:7777","-w","2","--timeout","15"]