bazelbuild / bazelbuild/rules_docker

portable_mtime for py3_image

Open
#2,269 1 comment 0 reactions 0 assignees View on GitHub
Can Close?
Dominant language
Starlark
Stars
1.1k
Forks
689
PR merge metrics
No merged PRs in 30d

Description

# 🚀 feature request

### Description

When using `py3_image` the _mtime_ (modification time) for all the files are set to 0 unix time (cira 1970). Some python libraries panic when they see that (eg. `zipfile` python builtin lib `ValueError: ZIP does not support timestamps before 1980`)

### Describe the solution you'd like

`container_image` has an option to set all mtimes to a fixed valued: see [`portable_mtime`](https://github.com/bazelbuild/rules_docker/blob/8e70c6bcb584a15a8fd061ea489b933c0ff344ca/container/layer.bzl#L355) but IIUC it needs to be routed to `py3_image` through the signatures somehow, hence this feature request.

Basically can we by default or through an option in `py3_image` set all the mtimes to something other than `0` ?

Contributor guide

Open the contributing guide

Research direction

Start with the portable_mtime option in container/layer.bzl and trace how py3_image constructs its image and forwards rule options. Determine where the option would enter the py3_image signature and how its default should behave. Done means py3_image can produce files with a nonzero fixed mtime so Python's zipfile accepts them.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
build-system, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.