Skip to content

Commit 6bef61c

Browse files
committed
chore(imagebuilder): change uid gid to 1001
1 parent 49c814e commit 6bef61c

3 files changed

Lines changed: 27 additions & 29 deletions

File tree

rootfs/Dockerfile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
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-
9-
ADD . /
10-
ENV PODMAN_VERSION="4.0.2" \
3+
ENV DRYCC_UID=1001 \
4+
DRYCC_GID=1001 \
5+
DRYCC_HOME_DIR=/home/drycc \
6+
PODMAN_VERSION="4.0.2" \
117
MC_VERSION="2022.02.26.03.58.31" \
128
CADDY_VERSION="2.4.6" \
139
PACK_VERSION="0.24.0" \
1410
GOSU_VERSION="1.14"
1511

12+
RUN groupadd drycc --gid ${DRYCC_GID} \
13+
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR}
14+
15+
ADD . /
16+
1617
RUN install-packages procps psmisc \
1718
&& install-stack podman $PODMAN_VERSION \
1819
&& install-stack mc $MC_VERSION \
1920
&& install-stack caddy $CADDY_VERSION \
2021
&& install-stack pack $PACK_VERSION \
2122
&& install-stack gosu $GOSU_VERSION \
2223
&& usermod --add-subuids 200000-201000 --add-subgids 200000-201000 drycc \
23-
&& chown -R drycc:drycc /opt/drycc/podman \
24+
&& chown -R ${DRYCC_GID}:${DRYCC_UID} /opt/drycc \
2425
&& rm -rf \
2526
/usr/share/doc \
2627
/usr/share/man \
@@ -37,9 +38,6 @@ RUN install-packages procps psmisc \
3738
&& mkdir -p /usr/share/man/man{1..8}
3839

3940
WORKDIR /workspace
40-
ENV HOME /tmp
41-
ENV XDG_DATA_HOME /tmp
42-
ENV XDG_CONFIG_HOME /tmp/.config
4341

4442
ENTRYPOINT ["init-stack", "/imagebuilder/prebuild", "/imagebuilder/build"]
4543

rootfs/imagebuilder/build

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,20 @@ function waiting_process {
2929
done
3030
}
3131

32-
# Start podman service
33-
export DOCKER_PORT=1234
34-
export DOCKER_HOST=tcp://127.0.0.1:${DOCKER_PORT}
35-
3632
log_level="error"
3733
if [[ "${DRYCC_DEBUG}" ]]; then
3834
log_level="debug"
3935
unset DRYCC_DEBUG
4036
fi
4137

38+
mkdir -p "${HOME}"/.config/containers
39+
cp -rf /opt/drycc/podman/etc/containers/* "${HOME}"/.config/containers
4240
registries="/etc/imagebuilder/registries.conf"
4341
if [ -f "${registries}" ]; then
44-
cat "${registries}" > /opt/drycc/podman/etc/containers/registries.conf
42+
cat "${registries}" > "${HOME}"/.config/containers/registries.conf
4543
fi
4644

47-
podman system service --time 0 tcp:0.0.0.0:${DOCKER_PORT} &
45+
podman system service --time 0 &
4846

4947
waiting_process podman
5048
if [[ -n "${TAR_PATH}" ]]; then
@@ -68,15 +66,14 @@ if [[ "${DRYCC_REGISTRY_LOCATION}" == "off-cluster" ]] ; then
6866
else
6967
# Start registry proxy
7068
registry="${DRYCC_REGISTRY_PROXY_HOST}:${DRYCC_REGISTRY_PROXY_PORT}"
71-
if [[ ${log_level} == "debug" ]] ; then
72-
output="/dev/stdout"
73-
else
74-
output="/dev/null"
75-
fi
76-
caddy reverse-proxy \
69+
70+
caddy_command="caddy reverse-proxy \
7771
--from ":${DRYCC_REGISTRY_PROXY_PORT}" \
78-
--to "${DRYCC_REGISTRY_SERVICE_HOST}:${DRYCC_REGISTRY_SERVICE_PORT}" \
79-
> "${output}" 2>&1 &
72+
--to "${DRYCC_REGISTRY_SERVICE_HOST}:${DRYCC_REGISTRY_SERVICE_PORT}""
73+
if [[ ${log_level} != "debug" ]] ; then
74+
caddy_command="${caddy_command} > /dev/null"
75+
fi
76+
$caddy_command 2>&1 &
8077
waiting_process caddy
8178
podman login \
8279
--username drycc \
@@ -105,6 +102,9 @@ if [[ "${DRYCC_STACK}" == "container" ]] ; then
105102
else
106103
echo "---> Building pack"
107104
echo "---> Using builder ${pack_builder}"
105+
# podman connection
106+
readonly DOCKER_HOST="unix://$(podman info -f "{{.Host.RemoteSocket.Path}}")"
107+
export DOCKER_HOST
108108
pack_command="pack build ${image_repo} \
109109
--builder ${pack_builder} \
110110
--docker-host ${DOCKER_HOST} \
@@ -113,8 +113,7 @@ else
113113
--publish \
114114
--cache-image ${image_cache_repo} \
115115
--tag ${image_latest_repo} \
116-
--network host \
117-
--verbose"
116+
--network host"
118117
if [[ $log_level == "debug" ]] ; then
119118
pack_command="$pack_command --verbose"
120119
fi

rootfs/imagebuilder/prebuild

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
set -e
44

55
mount --make-rshared /
6-
exec gosu drycc "$@"
6+
chown "${DRYCC_GID}":"${DRYCC_UID}" -R /workspace
7+
exec gosu "${DRYCC_UID}" "$@"

0 commit comments

Comments
 (0)