Skip to content

Commit b977bf7

Browse files
committed
Harden image defaults and add supply chain attestations
1 parent fb5830d commit b977bf7

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ jobs:
3131
context: .
3232
file: ./Dockerfile
3333
push: true
34+
provenance: mode=max
35+
sbom: true
3436
tags: |
3537
docker.io/cartheur/debian-bazel:latest

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ RUN curl -fsSL -o /usr/local/bin/bazel \
2323
&& chmod +x /usr/local/bin/bazel \
2424
&& ln -s /usr/local/bin/bazel /usr/local/bin/bazelisk
2525

26-
ENV BAZELISK_HOME=/usr/local/share/bazelisk
26+
RUN groupadd -g 10001 bazel \
27+
&& useradd -m -u 10001 -g bazel -s /bin/bash bazel \
28+
&& mkdir -p /workspace /home/bazel/.cache/bazelisk \
29+
&& chown -R bazel:bazel /workspace /home/bazel
30+
31+
ENV HOME=/home/bazel
32+
ENV BAZELISK_HOME=/home/bazel/.cache/bazelisk
2733
WORKDIR /workspace
34+
USER bazel
2835

2936
CMD ["bazel", "--version"]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
A Debian + Bazel build container for creating distroless-style images without pulling in extra Google project boilerplate.
44

5+
The container runs as a non-root `bazel` user by default.
6+
57
Use it in a multistage Dockerfile:
68

79
```dockerfile

0 commit comments

Comments
 (0)