|
1 | 1 | # syntax=docker/dockerfile:1 |
2 | 2 |
|
3 | | -FROM ghcr.io/linuxserver/baseimage-ubuntu:noble |
| 3 | +# Use Fedora as base OS as requested |
| 4 | +FROM fedora:42 |
4 | 5 |
|
5 | | -# set version label |
| 6 | +# labels and args |
6 | 7 | ARG BUILD_DATE |
7 | 8 | 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" |
11 | 15 |
|
12 | | -# environment settings |
13 | | -ARG DEBIAN_FRONTEND="noninteractive" |
| 16 | +# environment |
14 | 17 | ENV HOME="/config" |
15 | 18 |
|
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 \ |
20 | 29 | git \ |
21 | | - libatomic1 \ |
| 30 | + libatomic \ |
22 | 31 | nano \ |
23 | 32 | 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 ****"; \ |
26 | 48 | if [ -z ${CODE_RELEASE+x} ]; then \ |
27 | 49 | 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 |
47 | 80 |
|
48 | 81 | # ports and volumes |
49 | 82 | EXPOSE 8443 |
| 83 | + |
| 84 | +# default command |
| 85 | +ENTRYPOINT ["/usr/local/bin/start-code-server"] |
0 commit comments