Skip to content

Instantly share code, notes, and snippets.

View sumo-drosiek's full-sized avatar
🐧

Dominik Rosiek sumo-drosiek

🐧
  • Kraków, Poland
  • 09:56 (UTC +01:00)
View GitHub Profile
@sumo-drosiek
sumo-drosiek / Dockerfile
Last active November 23, 2022 09:34
Image with sudo and chmod only to be used as init-containers to change permissions of mounted EmptyDir
FROM alpine as alpine
RUN apk add sudo
RUN echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
RUN mkdir -p /src /src/bin /src/usr/bin /src/etc /src/lib/ /src/usr/lib/sudo/
RUN echo 'user:*:999:999:user:/_nonexistent:/bin/false' > /src/etc/passwd
RUN echo 'root:x:0:0:root:/root:/bin/false' >> /src/etc/passwd
RUN cp /bin/chmod /src/bin/chmod \
&& cp /usr/bin/sudo /src/usr/bin/sudo \
&& cp /etc/sudoers /src/etc \
&& cp /lib/ld-musl-x86_64.so.1 /lib/libz.so.1 /src/lib/ \
@sumo-drosiek
sumo-drosiek / semver_sort.sh
Created April 2, 2020 17:04
semver sort for git describe in bash
wget -q https://registry.hub.docker.com/v1/repositories/sumologic/kubernetes-fluentd/tags -O - | \
jq -r '.[].name' | \
grep -E '^.*-[0-9]+-g[0-9a-f]+$' | \
sed '/-/!{s/$/_/;}' | \
sed -E 's/[a-z]+/a:&/g' | \
sed -E 's/[0-9]+/d:&/g' | \
sort --version-sort --field-separator=. | \
sed -E 's/_$//' | \
sed -E 's/[ad]://g'