I've been building a ROCK for Traefik. I want to include a config file and have it owned by a specific user. Take the following excerpt as an example (full file here):
default-config:
plugin: dump
source: files
organize:
traefik.yaml: etc/traefik/traefik.yaml
001-default.yaml: var/lib/pebble/default/layers/001-default.yaml
stage:
- etc/traefik/traefik.yaml
- var/lib/pebble/default/layers/001-default.yaml
override-prime: |
craftctl default
ls -l etc/
chown -R 1000:1000 etc/traefik
ls -l etc/
non-root-user:
plugin: nil
after: [default-config]
overlay-script: |
# Create a user in the $CRAFT_OVERLAY chroot
useradd -R $CRAFT_OVERLAY -M -r -u 1000 -U traefik
I've added the ls -l as an example - the first shows the following:
I also attempted to chown the directory in the non-root-user stage after I'd created the user (within the chroot), but it can't see the /etc/traefik directory created in the previous stage from within the chroot.
Hey :wave:
I've been building a ROCK for Traefik. I want to include a config file and have it owned by a specific user. Take the following excerpt as an example (full file here):
I've added the
ls -l
as an example - the first shows the following:The second then shows that the
chown
is working as expected:However, when the image is built, if I get a shell and list the directory:
I also attempted to
chown
the directory in thenon-root-user
stage after I'd created the user (within the chroot), but it can't see the/etc/traefik
directory created in the previous stage from within thechroot
.