-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
-
First Check
- I added a very descriptive title here.
- I used the GitHub search to find a similar question and didn't find it.
- I searched in the documentation/README.
- I already searched in Google "How to do X" and didn't find any information.
- I already read and followed all the tutorial in the docs/README and didn't find an answer.
Commit to Help
- I commit to help with one of those options 👆
Example Code
Here is my backend Dockerfile:
https://github.com/nemanjam/githubcities/blob/main/backend/Dockerfile
FROM python:3.12.10-alpine3.22 # Install dependencies (tree and bash) RUN apk update RUN apk add --no-cache tree bash ENV PYTHONUNBUFFERED=1 WORKDIR /backend/ # Install uv from Astral COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /uvx /bin/ # Put executables in front of PATH ENV PATH="/backend/.venv/bin:$PATH" # Compile bytecode ENV UV_COMPILE_BYTECODE=1 # uv cache mode ENV UV_LINK_MODE=copy # Install project dependencies RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --frozen --no-install-project ENV PYTHONPATH=/backend COPY ./scripts /backend/scripts COPY ./pyproject.toml ./uv.lock ./alembic.ini /backend/ COPY ./app /backend/app # Sync the project RUN --mount=type=cache,target=/root/.cache/uv \ uv sync # Set entrypoint ENTRYPOINT ["scripts/entrypoint.sh"] # 8000 uvicorn default port
Description
Run the backend container, too high RAM usage.
Operating System
Linux
Operating System Details
Alpine, Debian Linux in Docker.
Python Version
python:3.12.10-alpine3.22
Additional Context
I am using the original Dockerfile, just changed to Alpine image and it takes 500 MB, and the original Debian container also uses 400 MB, why this happens?
For comparison frontend Next.js container takes 50 MB, so 10x less.
imageWhat is the explanation for this, can this be optimized?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment