Skip to content

Commit ff850db

Browse files
committed
Upgrade to Fedora:42
1 parent 748dbf9 commit ff850db

4 files changed

Lines changed: 121 additions & 33 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ Network Trash Folder
4242
Temporary Items
4343
.apdisk
4444
.jenkins-external
45+
46+
.idea

Dockerfile

Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,85 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-ubuntu:noble
3+
# Use Fedora as base OS as requested
4+
FROM fedora:42
45

5-
# set version label
6+
# labels and args
67
ARG BUILD_DATE
78
ARG VERSION
8-
ARG CODE_RELEASE
9-
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
10-
LABEL maintainer="aptalca"
9+
# v4.103.2
10+
ARG CODE_RELEASE
11+
LABEL org.opencontainers.image.title="code-server on Fedora"
12+
LABEL org.opencontainers.image.version="${VERSION}"
13+
LABEL org.opencontainers.image.created="${BUILD_DATE}"
14+
LABEL maintainer="container-code-server maintainers"
1115

12-
# environment settings
13-
ARG DEBIAN_FRONTEND="noninteractive"
16+
# environment
1417
ENV HOME="/config"
1518

16-
RUN \
17-
echo "**** install runtime dependencies ****" && \
18-
apt-get update && \
19-
apt-get install -y \
19+
#
20+
# Runtime and build dependencies via dnf
21+
# - Development Tools group for build essentials
22+
# - Fonts: IBM Plex
23+
# - Utilities required by scripts and code-server
24+
#
25+
RUN set -eux; \
26+
echo "**** install runtime dependencies ****"; \
27+
dnf -y update; \
28+
dnf -y install \
2029
git \
21-
libatomic1 \
30+
libatomic \
2231
nano \
2332
net-tools \
24-
sudo && \
25-
echo "**** install code-server ****" && \
33+
sudo \
34+
curl \
35+
tar \
36+
ca-certificates \
37+
nmap-ncat \
38+
fontconfig \
39+
ibm-plex-fonts-all; \
40+
echo "**** install development tools ****"; \
41+
dnf -y group install development-tools; \
42+
echo "**** create abc user and prepare dirs ****"; \
43+
groupadd -g 911 abc; \
44+
useradd -u 911 -g 911 -m -s /bin/bash abc; \
45+
mkdir -p /config/extensions /config/data /config/workspace /app/code-server; \
46+
chown -R abc:abc /config; \
47+
echo "**** install code-server ****"; \
2648
if [ -z ${CODE_RELEASE+x} ]; then \
2749
CODE_RELEASE=$(curl -sX GET https://api.github.com/repos/coder/code-server/releases/latest \
28-
| awk '/tag_name/{print $4;exit}' FS='[""]' | sed 's|^v||'); \
29-
fi && \
30-
mkdir -p /app/code-server && \
31-
curl -o \
32-
/tmp/code-server.tar.gz -L \
33-
"https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-amd64.tar.gz" && \
34-
tar xf /tmp/code-server.tar.gz -C \
35-
/app/code-server --strip-components=1 && \
36-
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
37-
echo "**** clean up ****" && \
38-
apt-get clean && \
39-
rm -rf \
40-
/config/* \
41-
/tmp/* \
42-
/var/lib/apt/lists/* \
43-
/var/tmp/*
44-
45-
# add local files
46-
COPY /root /
50+
| awk '/tag_name/{print $4;exit}' FS='["\"]' | sed 's|^v||'); \
51+
fi; \
52+
ARCH_TARBALL="linux-amd64"; \
53+
case "$(uname -m)" in \
54+
aarch64|arm64) ARCH_TARBALL="linux-arm64" ;; \
55+
x86_64|amd64) ARCH_TARBALL="linux-amd64" ;; \
56+
*) echo "Unsupported architecture: $(uname -m)"; exit 1 ;; \
57+
esac; \
58+
curl -o /tmp/code-server.tar.gz -L \
59+
"https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-${ARCH_TARBALL}.tar.gz"; \
60+
tar xf /tmp/code-server.tar.gz -C /app/code-server --strip-components=1; \
61+
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version; \
62+
echo "**** clean up ****"; \
63+
dnf clean all; \
64+
rm -rf /var/cache/dnf/* /tmp/* /var/tmp/*
65+
66+
# Install Rust (non-interactive) for user abc
67+
USER abc
68+
ENV PATH="/home/abc/.cargo/bin:${PATH}"
69+
RUN set -eux; \
70+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
71+
72+
# copy helper scripts and set entrypoint
73+
USER root
74+
COPY container-root/ /
75+
RUN chmod +x /usr/local/bin/start-code-server /usr/local/bin/install-extension && \
76+
chown -R abc:abc /usr/local/bin
77+
78+
# keep root for entrypoint to fix permissions, then drop to abc inside script
79+
USER root
4780

4881
# ports and volumes
4982
EXPOSE 8443
83+
84+
# default command
85+
ENTRYPOINT ["/usr/local/bin/start-code-server"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ "${EUID}" -eq 0 ]]; then
5+
# Run as abc if invoked by root
6+
exec runuser -u abc -- "$0" "$@"
7+
fi
8+
9+
"/app/code-server/bin/code-server" \
10+
--extensions-dir "/config/extensions" \
11+
--install-extension "$@"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Ensure required directories and ownership exist for logging and data
5+
mkdir -p /config/{extensions,data,workspace,.ssh}
6+
mkdir -p /config/.local/share/code-server/coder-logs
7+
8+
# If running as root, fix ownership and perms, then drop privileges
9+
if [[ "${EUID}" -eq 0 ]]; then
10+
chown -R 911:911 /config || true
11+
chmod 700 /config/.ssh || true
12+
# Drop to user abc to run code-server
13+
exec runuser -u abc -- "$0" "$@"
14+
fi
15+
16+
# Determine auth mode based on env
17+
if [[ -n "${PASSWORD:-}" || -n "${HASHED_PASSWORD:-}" ]]; then
18+
AUTH="password"
19+
else
20+
AUTH="none"
21+
echo "starting with no password"
22+
fi
23+
24+
PROXY_DOMAIN_ARG=""
25+
if [[ -n "${PROXY_DOMAIN:-}" ]]; then
26+
PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}"
27+
fi
28+
29+
PWA_APPNAME="${PWA_APPNAME:-code-server}"
30+
31+
exec /app/code-server/bin/code-server \
32+
--bind-addr 0.0.0.0:8443 \
33+
--user-data-dir /config/data \
34+
--extensions-dir /config/extensions \
35+
--disable-telemetry \
36+
--auth "${AUTH}" \
37+
--app-name "${PWA_APPNAME}" \
38+
${PROXY_DOMAIN_ARG} \
39+
"${DEFAULT_WORKSPACE:-/config/workspace}"

0 commit comments

Comments
 (0)