Skip to content

Commit

Permalink
Add user configuration to buildah container image
Browse files Browse the repository at this point in the history
The container has configuration for root,
this commit adds a similar configuration for the build user.

Closes: containers#4669

Signed-off-by: Norbert Lange <[email protected]>
  • Loading branch information
nolange committed Mar 20, 2023
1 parent a8ba52d commit 90ca6db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contrib/buildahimage/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,16 @@ RUN mkdir -p /var/lib/shared/overlay-images \
touch /var/lib/shared/vfs-images/images.lock && \
touch /var/lib/shared/vfs-layers/layers.lock

ADD ./user-storage.conf /tmp/storage.conf

# Define uid/gid ranges for our user https://github.com/containers/buildah/issues/3053
RUN useradd build && \
echo -e "build:1:999\nbuild:1001:64535" > /etc/subuid && \
echo -e "build:1:999\nbuild:1001:64535" > /etc/subgid && \
mkdir -p /home/build/.local/share/containers && \
mkdir -p /home/build/.config/containers && \
mv /tmp/storage.conf /home/build/.config/containers/storage.conf && \
chmod 700 /home/build/.config && \
chown -R build:build /home/build

VOLUME /var/lib/containers
Expand Down
11 changes: 11 additions & 0 deletions contrib/buildahimage/user-storage.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[storage]
driver = "overlay"

[storage.options]
additionalimagestores = [
"/var/lib/shared",
]

[storage.options.overlay]
mount_program = "/usr/bin/fuse-overlayfs"
mountopt = "nodev,fsync=0"

0 comments on commit 90ca6db

Please sign in to comment.