kubernetes / kubernetes/website

Modernize the Redis work-queue example Dockerfile

Open
#56,625 2 comments 0 reactions 1 assignee Claimed by @Gourav2580 View on GitHub
kind/feature language/en needs-triage sig/apps
Dominant language
HTML
Stars
5.4k
Forks
15.7k
Avg merge
4d 18h
Merged PRs (30d)
204

Description

### Description

The Dockerfile used by the
[Fine Parallel Processing Using a Work Queue](https://kubernetes.io/docs/tasks/job/fine-parallel-processing-work-queue/)
tutorial currently uses the unversioned `python` base image:

https://github.com/kubernetes/website/blob/main/content/en/examples/application/job/redis/Dockerfile

The current Dockerfile:

- depends on the mutable, full-size `python:latest` image
- retains the pip download cache
- places application files in the root directory
- uses two separate `COPY` instructions
- uses shell-form `CMD`

### Proposed improvement

I propose to:

- use a versioned slim Python image, such as `python:3.14-slim`
- install Redis using `python -m pip install --no-cache-dir redis`
- set `/app` as the working directory
- copy both Python files in one instruction
- use exec-form `CMD`

The proposed Dockerfile would be:

```dockerfile
FROM python:3.14-slim

WORKDIR /app

RUN python -m pip install --no-cache-dir redis

COPY worker.py rediswq.py ./

CMD ["python", "worker.py"]
```
I am open to using a different supported Python version if the maintainers
prefer another versioning policy.

### Testing

I plan to verify:

- the original and updated image sizes
- a clean Docker build
- connectivity to a Redis container
- successful processing of test queue items

I searched the current open issues and pull requests and did not find an
overlapping change. I would like to work on this improvement.

/language en
/sig apps

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.