Place /etc/passwd file inside the container for root user

This is needed because ssh requires the user that runs it to exist in /etc/passwd.
This commit is contained in:
Collin J. Doering 2023-12-29 12:03:48 -05:00
parent 6c8faca7a4
commit f2786e17ae
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
3 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*~
*.tar.gz
passwd

View File

@ -1,6 +1,7 @@
FROM scratch
ADD guix-tarball-pack.tar.gz /guix-builder
ADD links.tar.gz /
ADD passwd /etc/passwd
VOLUME /var/guix/daemon-socket/socket /gnu/store /etc/ssl
ENTRYPOINT ["/guix-builder/bin/bash"]

View File

@ -5,8 +5,12 @@ GUIX_MANIFEST_DEV := manifest-dev.scm
TARBALL ?= guix-tarball-pack.tar.gz
LINKS_TARBALL ?= links.tar.gz
PASSWD_FILE ?= passwd
IMAGE_TAG ?= guix-builder
$(PASSWD_FILE):
echo 'root:x:0:0:root:/root:/bin/sh' > passwd
$(LINKS_TARBALL):
ln -s /guix-builder/bin bin
tar -czvf $@ bin
@ -17,7 +21,7 @@ $(TARBALL):
@chmod +w $@
.PHONY: build
build: $(TARBALL) $(LINKS_TARBALL)
build: $(TARBALL) $(LINKS_TARBALL) $(PASSWD_FILE)
@docker build -t $(IMAGE_TAG) .
.PHONY: run
@ -36,4 +40,4 @@ shell:
.PHONY:
clean:
rm -r $(TARBALL) $(LINKS_TARBALL)
rm -r $(TARBALL) $(LINKS_TARBALL) $(PASSWD_FILE)