Skip to content

Commit 49c814e

Browse files
committed
feat(imagebuilder): run podman as rootless
1 parent 7e4c7bb commit 49c814e

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

rootfs/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
FROM docker.io/drycc/base:bullseye
22

3+
RUN adduser --system \
4+
--shell /bin/bash \
5+
--disabled-password \
6+
--home /workspace \
7+
--group drycc
8+
39
ADD . /
4-
ENV PODMAN_VERSION="4.0.1" \
10+
ENV PODMAN_VERSION="4.0.2" \
511
MC_VERSION="2022.02.26.03.58.31" \
612
CADDY_VERSION="2.4.6" \
7-
PACK_VERSION="0.24.0"
13+
PACK_VERSION="0.24.0" \
14+
GOSU_VERSION="1.14"
815

916
RUN install-packages procps psmisc \
1017
&& install-stack podman $PODMAN_VERSION \
1118
&& install-stack mc $MC_VERSION \
1219
&& install-stack caddy $CADDY_VERSION \
1320
&& install-stack pack $PACK_VERSION \
21+
&& install-stack gosu $GOSU_VERSION \
22+
&& usermod --add-subuids 200000-201000 --add-subgids 200000-201000 drycc \
23+
&& chown -R drycc:drycc /opt/drycc/podman \
1424
&& rm -rf \
1525
/usr/share/doc \
1626
/usr/share/man \
@@ -31,5 +41,5 @@ ENV HOME /tmp
3141
ENV XDG_DATA_HOME /tmp
3242
ENV XDG_CONFIG_HOME /tmp/.config
3343

34-
ENTRYPOINT ["init-stack", "/imagebuilder/build"]
44+
ENTRYPOINT ["init-stack", "/imagebuilder/prebuild", "/imagebuilder/build"]
3545

rootfs/imagebuilder/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fi
4141

4242
registries="/etc/imagebuilder/registries.conf"
4343
if [ -f "${registries}" ]; then
44-
cat "${registries}" > /etc/containers/registries.conf
44+
cat "${registries}" > /opt/drycc/podman/etc/containers/registries.conf
4545
fi
4646

4747
podman system service --time 0 tcp:0.0.0.0:${DOCKER_PORT} &

rootfs/imagebuilder/prebuild

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
mount --make-rshared /
6+
exec gosu drycc "$@"

0 commit comments

Comments
 (0)