gitpod-io / openvscode-server

Run upstream VS Code on a remote machine with access through a modern web browser from any device, anywhere.
https://www.gitpod.io/
MIT License
5.04k stars 438 forks source link

Possible to add openssh-server to container? #582

Closed redjax closed 3 days ago

redjax commented 3 days ago

I modified the openvscode-server Dockerfile as such:

ARG UV_BASE=${UV_IMG_VER:-0.4.27}
ARG OPENVSCODE_SERVER_BASE=${OPENVSCODE_SERVER_BASE:-latest}

FROM ghcr.io/astral-sh/uv:$UV_BASE AS uv
FROM gitpod/openvscode-server:$OPENVSCODE_SERVER_BASE AS base

## Add Astral uv to the container
COPY --from=uv /uv /bin/uv

ENV OPENVSCODE_SERVER_ROOT="/home/.openvscode-server"
ENV OPENVSCODE="${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server"

SHELL ["/bin/bash", "-c"]

RUN \
  # ## Direct download links to external .vsix not available on https://open-vsx.org/
  # #  The two links here are just used as example, they are actually available on https://open-vsx.org/
  # urls=(\
  # https://github.com/rust-lang/rust-analyzer/releases/download/2022-12-26/rust-analyzer-linux-x64.vsix \
  # https://github.com/VSCodeVim/Vim/releases/download/v1.24.3/vim-1.24.3.vsix \
  # )\
  # ## Create a tmp dir for downloading
  # && tdir=/tmp/exts && mkdir -p "${tdir}" && cd "${tdir}" \
  # ## Download via wget from $urls array.
  # && wget "${urls[@]}" && \
  ## Download extensions from open-vsx.org by id
  exts=(\
  # From https://open-vsx.org/ registry directly
  christian-kohler.path-intellisense \
  # detachhead.basedpyright \ 
  eamodio.gitlens \ 
  esbenp.prettier-vscode \ 
  formulahendry.auto-close-tag \ 
  formulahendry.auto-rename-tag \ 
  mhutchie.git-graph \  
  # mtxr.sqltools \ 
  # mtxr.sqltools-driver-mysql \ 
  # mtxr.sqltools-driver-pg \ 
  # mtxr.sqltools-driver-sqlite \ 
  # redhat.ansible \
  redhat.vscode-xml \ 
  redhat.vscode-yaml \ 
  samuelcolvin.jinjahtml \ 
  tamasfe.even-better-toml \ 
  waderyan.gitblame \ 
  yzhang.markdown-all-in-one \
  # From filesystem, .vsix that we downloaded (using bash wildcard '*')
  # "${tdir}"/* \
  )\
  # Install the $exts
  && for ext in "${exts[@]}"; do ${OPENVSCODE} --install-extension "${ext}"; done

I added some extensions by ID, and added Astral's uv to the image. I would like to use git from the browser, but SSH does not appear to be installed, I get this error when I try fetching/pushing/pulling with the git GUI:

error: cannot run ssh: No such file or directory
fatal: unable to fork

I have tried adding this to the Dockerfile, but I get an error about sudo:

...

RUN apt-get install -y && apt-get install -y openssh-server

I've read through issues and documentation and will continue looking for an answer, but in case I've missed it/nobody's asked, is it possible to install additional packages in the openvscode-server Docker image?

redjax commented 3 days ago

Woops, I found my answer right in the README. Sorry for missing it the first time!