Skip to content

Commit

Permalink
Merge pull request #122 from cytopia/release-0.48
Browse files Browse the repository at this point in the history
Release 0.48
  • Loading branch information
cytopia authored Dec 3, 2022
2 parents b779745 + 7f0a9b0 commit 3e50309
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Dockerfiles/Dockerfile-awsk8s
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ RUN set -eux \
fail; \
fi \
\
&& KUBECTL_VERSION="$(curl -sS --fail https://storage.googleapis.com/kubernetes-release/release/stable.txt)" \
&& curl -sS -L --fail -o /usr/bin/kubectl \
https://storage.googleapis.com/kubernetes-release/release/$(curl -sS --fail https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${ARCH}/kubectl \
https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl \
&& chmod +x /usr/bin/kubectl \
&& kubectl version --client --short=true 2>&1 | grep -E 'v[.0-9]+'

Expand All @@ -49,7 +50,8 @@ RUN set -eux \
&& exit 0; \
fi \
\
&& curl -sS -L --fail -o /tmp/openshift-client-linux.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz \
&& curl -sS -L --fail -o /tmp/openshift-client-linux.tar.gz \
https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz \
&& mkdir /tmp/openshift-client-linux/ \
&& tar -xzf /tmp/openshift-client-linux.tar.gz -C /tmp/openshift-client-linux/ \
&& mv /tmp/openshift-client-linux/oc /usr/bin/oc-dynamically-linked \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ COPY --from=builder /usr/bin/ansible* /usr/bin/

# Pre-compile Python for better performance
RUN set -eux \
&& python3 -m compileall /usr/lib/python3.10
&& python3 -m compileall -j 0 /usr/lib/python3.10

WORKDIR /data
CMD ["/bin/sh"]
25 changes: 24 additions & 1 deletion Dockerfiles/data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,37 @@ update_uid_gid() {
local gid="${4}"


echo "[INFO] Adjusting local user with uid:${uid} and gid:${gid}"
echo "[INFO] Adjusting local user '${user}' with uid:${uid} and gid:${gid}"

# Remove previous user/group
if ! deluser "${user}"; then
>&2 echo "[ERR] Failed to delete user: ${user}"
exit 1
fi

# Check if current group id already exists and fix it
tmp_gid="${gid}"
if grep -q "x:${tmp_gid}:" /etc/group; then
tmp_grp="$( grep "x:${tmp_gid}:" /etc/group | awk -F':' '{print $1}' )"
while grep -q "x:${tmp_gid}:" /etc/group; do
tmp_gid="$(( tmp_gid + 1 ))"
done
# Simply change the already existing group id to something else
echo "[INFO] Group '${tmp_grp}' with gid '${gid}' already exists. Moving it to ${tmp_grp}:x:${tmp_gid}"
sed -i'' "s/x:${gid}:/x:${tmp_gid}:/g" /etc/group
fi
# Check if current user id already exists and fix it
tmp_uid="${uid}"
if grep -q "x:${tmp_uid}:" /etc/passwd; then
tmp_usr="$( grep "x:${tmp_uid}:" /etc/passwd | awk -F':' '{print $1}' )"
while grep -q "x:${tmp_uid}:" /etc/passwd; do
tmp_uid="$(( tmp_uid + 1 ))"
done
# Simply change the already existing user id to something else
echo "[INFO] User '${tmp_usr}' with uid '${uid}' already exists. Moving it to ${tmp_usr}:x:${tmp_uid}"
sed -i'' "s/x:${uid}:/x:${tmp_uid}:/g" /etc/passwd
fi

# Add new user/group
if ! addgroup -g "${gid}" "${group}"; then
>&2 echo "[ERR] Failed to add group ${group} (gid:${gid})"
Expand Down

0 comments on commit 3e50309

Please sign in to comment.