Skip to content

Commit a2d35ad

Browse files
authored
docker: add Fedora 39 and openSUSE Tumbleweed based images (#6669)
1 parent 76e6f75 commit a2d35ad

File tree

5 files changed

+164
-1
lines changed

5 files changed

+164
-1
lines changed

.github/workflows/publish.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,22 @@ jobs:
183183
TAG="${{ github.event.inputs.version || github.ref_name }}"
184184
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
185185
186-
- name: Download release artifacts
186+
- name: Download deb artifacts
187187
uses: robinraju/[email protected]
188188
with:
189189
repository: "coder/code-server"
190190
tag: v${{ env.VERSION }}
191191
fileName: "*.deb"
192192
out-file-path: "release-packages"
193193

194+
- name: Download rpm artifacts
195+
uses: robinraju/[email protected]
196+
with:
197+
repository: "coder/code-server"
198+
tag: v${{ env.VERSION }}
199+
fileName: "*.rpm"
200+
out-file-path: "release-packages"
201+
194202
- name: Publish to Docker
195203
run: ./ci/steps/docker-buildx-push.sh
196204
env:

ci/release-image/Dockerfile.fedora

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# syntax=docker/dockerfile:experimental
2+
3+
ARG BASE=fedora:39
4+
FROM scratch AS packages
5+
COPY release-packages/code-server*.rpm /tmp/
6+
7+
FROM $BASE
8+
9+
RUN dnf update -y \
10+
&& dnf install -y \
11+
curl \
12+
git \
13+
git-lfs \
14+
htop \
15+
nano \
16+
openssh-clients \
17+
procps \
18+
wget \
19+
zsh \
20+
dumb-init \
21+
glibc-langpack-en \
22+
&& rm -rf /var/cache/dnf
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.sh /usr/bin/entrypoint.sh
38+
RUN --mount=from=packages,src=/tmp,dst=/tmp/packages dnf install -y /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.sh", "--bind-addr", "0.0.0.0:8080", "."]

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

+26
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ group "default" {
1818
targets = [
1919
"code-server-debian-12",
2020
"code-server-ubuntu-focal",
21+
"code-server-fedora-39",
22+
"code-server-opensuse-tumbleweed",
2123
]
2224
}
2325

@@ -66,3 +68,27 @@ target "code-server-ubuntu-focal" {
6668
}
6769
platforms = ["linux/amd64", "linux/arm64"]
6870
}
71+
72+
target "code-server-fedora-39" {
73+
dockerfile = "ci/release-image/Dockerfile.fedora"
74+
tags = concat(
75+
gen_tags_for_docker_and_ghcr("fedora"),
76+
gen_tags_for_docker_and_ghcr("39"),
77+
)
78+
args = {
79+
BASE = "fedora:39"
80+
}
81+
platforms = ["linux/amd64", "linux/arm64"]
82+
}
83+
84+
target "code-server-opensuse-tumbleweed" {
85+
dockerfile = "ci/release-image/Dockerfile.opensuse"
86+
tags = concat(
87+
gen_tags_for_docker_and_ghcr("opensuse"),
88+
gen_tags_for_docker_and_ghcr("tumbleweed"),
89+
)
90+
args = {
91+
BASE = "opensuse/tumbleweed"
92+
}
93+
platforms = ["linux/amd64", "linux/arm64"]
94+
}
+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)