Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python3-requirements examble to debian12 and use fstring in Python Code #1648

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/python3-requirements/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# * Install python3-venv for the built-in Python3 venv module (not installed by default)
# * Install gcc libpython3-dev to compile C Python modules
# * In the virtualenv: Update pip setuputils and wheel to support building new packages
FROM debian:11-slim AS build
FROM debian:12-slim AS build
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \
python3 -m venv /venv && \
Expand All @@ -14,7 +14,7 @@ COPY requirements.txt /requirements.txt
RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt

# Copy the virtualenv into a distroless image
FROM gcr.io/distroless/python3-debian11
FROM gcr.io/distroless/python3-debian12
COPY --from=build-venv /venv /venv
COPY . /app
WORKDIR /app
Expand Down
3 changes: 1 addition & 2 deletions examples/python3-requirements/psutil_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def mib(total_bytes):
def main():
current_process = psutil.Process()
memory = current_process.memory_info()
print('RSS: {:.1f} MiB; SHARED: {:.1f} MiB; VIRTUAL: {:.1f} MiB'.format(
mib(memory.rss), mib(memory.shared), mib(memory.vms)))
print(f'RSS: {mib(memory.rss):.1f} MiB; SHARED: {mib(memory.shared):.1f} MiB; VIRTUAL: {mib(memory.vms):.1f} MiB')


if __name__ == '__main__':
Expand Down
Loading