From 3b59cd4197e1bf0411570c2a8d67313c2d1f2c5a Mon Sep 17 00:00:00 2001 From: thespad Date: Mon, 19 Aug 2024 18:51:04 +0100 Subject: [PATCH 1/2] Rebase to noble --- Dockerfile | 5 ++--- Dockerfile.aarch64 | 5 ++--- Jenkinsfile | 4 ++-- README.md | 5 +++-- jenkins-vars.yml | 4 ++-- readme-vars.yml | 14 ++++---------- root/etc/s6-overlay/s6-rc.d/init-code-server/run | 14 +++++++++----- root/etc/s6-overlay/s6-rc.d/init-code-server/type | 2 +- root/etc/s6-overlay/s6-rc.d/init-code-server/up | 2 +- .../s6-rc.d/svc-code-server/notification-fd | 2 +- root/etc/s6-overlay/s6-rc.d/svc-code-server/run | 5 +++-- root/etc/s6-overlay/s6-rc.d/svc-code-server/type | 2 +- root/usr/local/bin/install-extension | 2 +- 13 files changed, 32 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index 50a3794b0..d18f040a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-ubuntu:jammy +FROM ghcr.io/linuxserver/baseimage-ubuntu:noble # set version label ARG BUILD_DATE @@ -16,11 +16,9 @@ RUN \ apt-get update && \ apt-get install -y \ git \ - jq \ libatomic1 \ nano \ net-tools \ - netcat \ sudo && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ @@ -33,6 +31,7 @@ RUN \ "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-amd64.tar.gz" && \ tar xf /tmp/code-server.tar.gz -C \ /app/code-server --strip-components=1 && \ + printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ echo "**** clean up ****" && \ apt-get clean && \ rm -rf \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 9502c20a6..3d93ba6ff 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,4 @@ -FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-jammy +FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-noble # set version label ARG BUILD_DATE @@ -16,11 +16,9 @@ RUN \ apt-get update && \ apt-get install -y \ git \ - jq \ libatomic1 \ nano \ net-tools \ - netcat \ sudo && \ echo "**** install code-server ****" && \ if [ -z ${CODE_RELEASE+x} ]; then \ @@ -33,6 +31,7 @@ RUN \ "https://github.com/coder/code-server/releases/download/v${CODE_RELEASE}/code-server-${CODE_RELEASE}-linux-arm64.tar.gz" && \ tar xf /tmp/code-server.tar.gz -C \ /app/code-server --strip-components=1 && \ + printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \ echo "**** clean up ****" && \ apt-get clean && \ rm -rf \ diff --git a/Jenkinsfile b/Jenkinsfile index 791aea0ce..8154a51d6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,8 +33,8 @@ pipeline { CI_PORT='8443' CI_SSL='false' CI_DELAY='120' - CI_DOCKERENV='TZ=US/Pacific' - CI_AUTH='user:password' + CI_DOCKERENV='' + CI_AUTH='' CI_WEBPATH='' } stages { diff --git a/README.md b/README.md index 1557cb522..7caa4795a 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ services: - PROXY_DOMAIN=code-server.my.domain #optional - DEFAULT_WORKSPACE=/config/workspace #optional volumes: - - /path/to/appdata/config:/config + - /path/to/code-server/config:/config ports: - 8443:8443 restart: unless-stopped @@ -122,7 +122,7 @@ docker run -d \ -e PROXY_DOMAIN=code-server.my.domain `#optional` \ -e DEFAULT_WORKSPACE=/config/workspace `#optional` \ -p 8443:8443 \ - -v /path/to/appdata/config:/config \ + -v /path/to/code-server/config:/config \ --restart unless-stopped \ lscr.io/linuxserver/code-server:latest ``` @@ -306,6 +306,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **19.08.24:** - Rebase to Ubuntu Noble. * **01.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf) * **05.10.22:** - Install recommended deps to maintain parity with the older images. * **29.09.22:** - Rebase to jammy, switch to s6v3. Fix chown logic to skip `/config/workspace` contents. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 59318932c..d9a9058b8 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -22,6 +22,6 @@ repo_vars: - CI_PORT='8443' - CI_SSL='false' - CI_DELAY='120' - - CI_DOCKERENV='TZ=US/Pacific' - - CI_AUTH='user:password' + - CI_DOCKERENV='' + - CI_AUTH='' - CI_WEBPATH='' diff --git a/readme-vars.yml b/readme-vars.yml index e5a145fce..1c49ea63b 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -10,22 +10,16 @@ project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_ available_architectures: - {arch: "{{ arch_x86_64 }}", tag: "amd64-latest"} - {arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"} -# development version -development_versions: false -development_versions_items: - - {tag: "latest", desc: "Stable releases"} + # container parameters common_param_env_vars_enabled: true param_container_name: "{{ project_name }}" param_usage_include_vols: true param_volumes: - - {vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Contains all relevant configuration files."} + - {vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Contains all relevant configuration files."} param_usage_include_ports: true param_ports: - {external_port: "8443", internal_port: "8443", port_desc: "web gui"} -param_usage_include_env: true -param_env_vars: - - {env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London"} # optional container parameters opt_param_usage_include_env: true opt_param_env_vars: @@ -35,8 +29,7 @@ opt_param_env_vars: - {env_var: "SUDO_PASSWORD_HASH", env_value: "", desc: "Optionally set sudo password via hash (takes priority over `SUDO_PASSWORD` var). Format is `$type$salt$hashed`."} - {env_var: "PROXY_DOMAIN", env_value: "code-server.my.domain", desc: "If this optional variable is set, this domain will be proxied for subdomain proxying. See [Documentation](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#sub-domains)"} - {env_var: "DEFAULT_WORKSPACE", env_value: "/config/workspace", desc: "If this optional variable is set, code-server will open this directory by default"} -optional_block_1: false -optional_block_1_items: "" + # application setup block app_setup_block_enabled: true app_setup_block: | @@ -54,6 +47,7 @@ app_setup_block: | How to create the [hashed password](https://github.com/cdr/code-server/blob/master/docs/FAQ.md#can-i-store-my-password-hashed). # changelog changelogs: + - {date: "19.08.24:", desc: "Rebase to Ubuntu Noble."} - {date: "01.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"} - {date: "05.10.22:", desc: "Install recommended deps to maintain parity with the older images."} - {date: "29.09.22:", desc: "Rebase to jammy, switch to s6v3. Fix chown logic to skip `/config/workspace` contents."} diff --git a/root/etc/s6-overlay/s6-rc.d/init-code-server/run b/root/etc/s6-overlay/s6-rc.d/init-code-server/run index d93a4d269..883024d8e 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-code-server/run +++ b/root/etc/s6-overlay/s6-rc.d/init-code-server/run @@ -1,14 +1,15 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash mkdir -p /config/{extensions,data,workspace,.ssh} -if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then +if [[ -n "${SUDO_PASSWORD}" ]] || [[ -n "${SUDO_PASSWORD_HASH}" ]]; then echo "setting up sudo access" if ! grep -q 'abc' /etc/sudoers; then echo "adding abc to sudoers" echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers fi - if [ -n "${SUDO_PASSWORD_HASH}" ]; then + if [[ -n "${SUDO_PASSWORD_HASH}" ]]; then echo "setting sudo password using sudo password hash" sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow else @@ -17,15 +18,18 @@ if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then fi fi -[[ ! -f /config/.bashrc ]] && \ +if [[ ! -f /config/.bashrc ]]; then cp /root/.bashrc /config/.bashrc -[[ ! -f /config/.profile ]] && \ +fi + +if [[ ! -f /config/.profile ]]; then cp /root/.profile /config/.profile +fi # fix permissions (ignore contents of /config/workspace) find /config -path /config/workspace -prune -o -exec chown abc:abc {} + chown abc:abc /config/workspace chmod 700 /config/.ssh -if [ -n "$(ls -A /config/.ssh)" ]; then +if [[ -n "$(ls -A /config/.ssh)" ]]; then chmod 600 /config/.ssh/* fi diff --git a/root/etc/s6-overlay/s6-rc.d/init-code-server/type b/root/etc/s6-overlay/s6-rc.d/init-code-server/type index 3d92b15f2..bdd22a185 100644 --- a/root/etc/s6-overlay/s6-rc.d/init-code-server/type +++ b/root/etc/s6-overlay/s6-rc.d/init-code-server/type @@ -1 +1 @@ -oneshot \ No newline at end of file +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-code-server/up b/root/etc/s6-overlay/s6-rc.d/init-code-server/up index 4efdc97b1..3b22ac91f 100644 --- a/root/etc/s6-overlay/s6-rc.d/init-code-server/up +++ b/root/etc/s6-overlay/s6-rc.d/init-code-server/up @@ -1 +1 @@ -/etc/s6-overlay/s6-rc.d/init-code-server/run \ No newline at end of file +/etc/s6-overlay/s6-rc.d/init-code-server/run diff --git a/root/etc/s6-overlay/s6-rc.d/svc-code-server/notification-fd b/root/etc/s6-overlay/s6-rc.d/svc-code-server/notification-fd index e440e5c84..00750edc0 100644 --- a/root/etc/s6-overlay/s6-rc.d/svc-code-server/notification-fd +++ b/root/etc/s6-overlay/s6-rc.d/svc-code-server/notification-fd @@ -1 +1 @@ -3 \ No newline at end of file +3 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-code-server/run b/root/etc/s6-overlay/s6-rc.d/svc-code-server/run index 373dc0af9..97c7e09e5 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-code-server/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-code-server/run @@ -1,13 +1,14 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash -if [ -n "${PASSWORD}" ] || [ -n "${HASHED_PASSWORD}" ]; then +if [[ -n "${PASSWORD}" ]] || [[ -n "${HASHED_PASSWORD}" ]]; then AUTH="password" else AUTH="none" echo "starting with no password" fi -if [ -z ${PROXY_DOMAIN+x} ]; then +if [[ -z ${PROXY_DOMAIN+x} ]]; then PROXY_DOMAIN_ARG="" else PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}" diff --git a/root/etc/s6-overlay/s6-rc.d/svc-code-server/type b/root/etc/s6-overlay/s6-rc.d/svc-code-server/type index 1780f9f44..5883cff0c 100644 --- a/root/etc/s6-overlay/s6-rc.d/svc-code-server/type +++ b/root/etc/s6-overlay/s6-rc.d/svc-code-server/type @@ -1 +1 @@ -longrun \ No newline at end of file +longrun diff --git a/root/usr/local/bin/install-extension b/root/usr/local/bin/install-extension index 79c922a68..48dfbb201 100755 --- a/root/usr/local/bin/install-extension +++ b/root/usr/local/bin/install-extension @@ -3,7 +3,7 @@ _install=(/app/code-server/bin/code-server "--extensions-dir" "/config/extensions" "--install-extension") -if [ "$(whoami)" == "abc" ]; then +if [[ "$(whoami)" == "abc" ]]; then "${_install[@]}" "$@" else s6-setuidgid abc "${_install[@]}" "$@" From f6e7d4e563ed2d01dfcbceacbd14a452f0ea4a18 Mon Sep 17 00:00:00 2001 From: thespad Date: Mon, 19 Aug 2024 20:31:41 +0100 Subject: [PATCH 2/2] Add Dockerfile syntax --- Dockerfile | 2 ++ Dockerfile.aarch64 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index d18f040a5..9ac98d925 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# syntax=docker/dockerfile:1 + FROM ghcr.io/linuxserver/baseimage-ubuntu:noble # set version label diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 3d93ba6ff..6e0525070 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,3 +1,5 @@ +# syntax=docker/dockerfile:1 + FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-noble # set version label