Skip to content

Commit a70a36f

Browse files
committed
docker: add openSUSE Tumbleweed based image
1 parent 828f94b commit a70a36f

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

ci/release-image/Dockerfile.opensuse

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# syntax=docker/dockerfile:experimental
2+
3+
ARG BASE=opensuse/tumbleweed
4+
FROM scratch AS packages
5+
COPY release-packages/code-server*.rpm /tmp/
6+
7+
FROM $BASE
8+
9+
RUN zypper dup -y \
10+
&& zypper in -y \
11+
curl \
12+
git \
13+
git-lfs \
14+
htop \
15+
nano \
16+
openssh-clients \
17+
procps \
18+
wget \
19+
zsh \
20+
sudo \
21+
catatonit \
22+
&& rm -rf /var/cache/zypp /var/cache/zypper
23+
RUN git lfs install
24+
25+
ENV LANG=en_US.UTF-8
26+
RUN echo 'LANG="en_US.UTF-8"' > /etc/locale.conf
27+
28+
RUN useradd -u 1000 coder && echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
29+
30+
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g')" \
31+
&& curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v0.6.0/fixuid-0.6.0-linux-$ARCH.tar.gz" | tar -C /usr/local/bin -xzf - \
32+
&& chown root:root /usr/local/bin/fixuid \
33+
&& chmod 4755 /usr/local/bin/fixuid \
34+
&& mkdir -p /etc/fixuid \
35+
&& printf "user: coder\ngroup: coder\n" > /etc/fixuid/config.yml
36+
37+
COPY ci/release-image/entrypoint-catatonit.sh /usr/bin/entrypoint-catatonit.sh
38+
RUN --mount=from=packages,src=/tmp,dst=/tmp/packages rpm -i /tmp/packages/code-server*$(uname -m | sed 's/x86_64/amd64/g' | sed 's/aarch64/arm64/g').rpm
39+
40+
# Allow users to have scripts run on container startup to prepare workspace.
41+
# https://github.com/coder/code-server/issues/5177
42+
ENV ENTRYPOINTD=${HOME}/entrypoint.d
43+
44+
EXPOSE 8080
45+
# This way, if someone sets $DOCKER_USER, docker-exec will still work as
46+
# the uid will remain the same. note: only relevant if -u isn't passed to
47+
# docker-run.
48+
USER 1000
49+
ENV USER=coder
50+
WORKDIR /home/coder
51+
ENTRYPOINT ["/usr/bin/entrypoint-catatonit.sh", "--bind-addr", "0.0.0.0:8080", "."]

ci/release-image/docker-bake.hcl

+12
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,15 @@ target "code-server-fedora-39" {
7878
}
7979
platforms = ["linux/amd64", "linux/arm64"]
8080
}
81+
82+
target "code-server-opensuse-tumbleweed" {
83+
dockerfile = "ci/release-image/Dockerfile.opensuse"
84+
tags = concat(
85+
gen_tags_for_docker_and_ghcr("opensuse"),
86+
gen_tags_for_docker_and_ghcr("tumbleweed"),
87+
)
88+
args = {
89+
BASE = "opensuse/tumbleweed"
90+
}
91+
platforms = ["linux/amd64", "linux/arm64"]
92+
}
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
# We do this first to ensure sudo works below when renaming the user.
5+
# Otherwise the current container UID may not exist in the passwd database.
6+
eval "$(fixuid -q)"
7+
8+
if [ "${DOCKER_USER-}" ]; then
9+
USER="$DOCKER_USER"
10+
if [ "$DOCKER_USER" != "$(whoami)" ]; then
11+
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
12+
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
13+
# nor can we bind mount $HOME into a new home as that requires a privileged container.
14+
sudo usermod --login "$DOCKER_USER" coder
15+
sudo groupmod -n "$DOCKER_USER" coder
16+
17+
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
18+
fi
19+
fi
20+
21+
# Allow users to have scripts run on container startup to prepare workspace.
22+
# https://github.com/coder/code-server/issues/5177
23+
if [ -d "${ENTRYPOINTD}" ]; then
24+
find "${ENTRYPOINTD}" -type f -executable -print -exec {} \;
25+
fi
26+
27+
exec catatonit -- /usr/bin/code-server "$@"

0 commit comments

Comments
 (0)