Skip to content

Instantly share code, notes, and snippets.

@sofianhamiti
Last active March 11, 2025 09:20
Show Gist options
  • Save sofianhamiti/302f7120559b1d1e5a088a6199e46f3b to your computer and use it in GitHub Desktop.
Save sofianhamiti/302f7120559b1d1e5a088a6199e46f3b to your computer and use it in GitHub Desktop.
FROM public.ecr.aws/sagemaker/sagemaker-distribution:latest-cpu
# Set environment variables
ARG NB_USER="sagemaker-user"
ARG NB_UID=1000
ARG NB_GID=100
ENV MAMBA_USER=$NB_USER
USER root
# Install Scrapy
RUN micromamba install -y --name base -c conda-forge scrapy
# Install Code-Server with VSCode= 1.95.3
WORKDIR /tmp
RUN curl -LO https://github.com/coder/code-server/releases/download/v4.95.3/code-server_4.95.3_amd64.deb \
&& sudo dpkg -i code-server_4.95.3_amd64.deb \
&& sudo apt-get install -f \
&& rm code-server_4.95.3_amd64.deb
# Configure Code-Server product.json to support Copilot
RUN curl https://gist.githubusercontent.com/sofianhamiti/ee58ee1d38418c8e778445fdd2cbe844/raw/077d009e9330e2a5921b5b0e0fa92a4c48b19707/product.json > /usr/lib/code-server/lib/vscode/product.json
# Increase file watch limit for code-server
RUN /bin/su -c "echo 'fs.inotify.max_user_watches=524288' >> /etc/sysctl.conf" && \
sysctl -p
WORKDIR /home/sagemaker-user
# Switch to non-root user
USER $MAMBA_USER
ENTRYPOINT ["code-server", "--auth", "none", "--bind-addr", "0.0.0.0:8888", "--user-data-dir=/home/sagemaker-user/vscode-config"]
@dpaletti
Copy link

Hi,
thank you very much for this valuable dockerfile.
As of today, it does not work anymore on Sagemaker Code Editor with the following error

[09:12:47] Error: Unexpected SIGPIPE
    at process.<anonymous> (file:///usr/lib/code-server/lib/vscode/out/server-main.js:187:1327)
    at process.emit (node:events:531:35)

In general, this would be valuable as sagemaker code editor at is running on a ridiculously old VSCode version.
Looking into this kind of stuff to get basedpyright working to have nice intellisense on python notebooks.

Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment