From 1a2929d8caf0d3180f4437c1b390bc7ffdfeaefc Mon Sep 17 00:00:00 2001 From: bgme Date: Wed, 17 Jan 2024 18:09:57 +0800 Subject: [PATCH] update Dockerfile --- docker/Dockerfile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0ab9dbe5d7ec..696558196098 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,14 +20,14 @@ # `poetry export | pip install -r /dev/stdin`, but beware: we have experienced bugs in # in `poetry export` in the past. -ARG PYTHON_VERSION=3.10 +ARG PYTHON_VERSION=3.11 ### ### Stage 0: generate requirements.txt ### # We hardcode the use of Debian bookworm here because this could change upstream # and other Dockerfiles used for testing are expecting bookworm. -FROM pypy:${PYTHON_VERSION}-slim-bookworm as requirements +FROM docker.io/library/python:${PYTHON_VERSION}-slim-bookworm as requirements # RUN --mount is specific to buildkit and is documented at # https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#build-mounts-run---mount. @@ -65,13 +65,11 @@ WORKDIR /synapse # Copy just what we need to run `poetry export`... COPY pyproject.toml poetry.lock /synapse/ - # Install custom extensions RUN /root/.local/bin/poetry add --lock -- \ "git+https://github.com/devture/matrix-synapse-shared-secret-auth#master" \ "git+https://github.com/matrix-org/mjolnir.git#main&subdirectory=synapse_antispam" - # If specified, we won't verify the hashes of dependencies. # This is only needed if the hashes of dependencies cannot be checked for some # reason, such as when a git repository is used directly as a dependency. @@ -85,7 +83,7 @@ ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE # Otherwise, just create an empty requirements file so that the Dockerfile can # proceed. RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \ - /root/.local/bin/poetry export --without-hashes --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}; \ + /root/.local/bin/poetry export --extras all -o /synapse/requirements.txt --without-hashes; \ else \ touch /synapse/requirements.txt; \ fi @@ -93,7 +91,7 @@ RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \ ### ### Stage 1: builder ### -FROM pypy:${PYTHON_VERSION}-slim-bookworm as builder +FROM docker.io/library/python:${PYTHON_VERSION}-slim-bookworm as builder # install the OS build deps RUN \ @@ -164,7 +162,7 @@ RUN --mount=type=cache,target=/synapse/target,sharing=locked \ ### Stage 2: runtime ### -FROM pypy:${PYTHON_VERSION}-slim-bookworm +FROM docker.io/library/python:${PYTHON_VERSION}-slim-bookworm LABEL org.opencontainers.image.url='https://matrix.org/docs/projects/server/synapse' LABEL org.opencontainers.image.documentation='https://github.com/element-hq/synapse/blob/master/docker/README.md' @@ -187,18 +185,13 @@ RUN \ openssl \ && rm -rf /var/lib/apt/lists/* -COPY --from=builder /install /opt/pypy +COPY --from=builder /install /usr/local COPY ./docker/start.py /start.py COPY ./docker/conf /conf - -# Patch for pypy -RUN pip uninstall -y psycopg2 pympler - - EXPOSE 8008/tcp 8009/tcp 8448/tcp ENTRYPOINT ["/start.py"] HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \ - CMD curl -fSs http://localhost:8008/health || exit 1 + CMD curl -fSs http://localhost:8008/health || exit 1 \ No newline at end of file