code-server / Dockerfile
Jarvis Bot
Fix dufs download URL to use .tar.gz release asset
ceb225e
# Use Python 3.9 as the base image
FROM python:3.9
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
# Install system packages
RUN apt-get update && \
apt-get install -y \
curl \
sudo \
build-essential \
default-jdk \
default-jre \
g++ \
gcc \
libzbar0 \
fish \
ffmpeg \
nmap \
ca-certificates \
zsh \
rclone \
nginx \
wget && \
rm -rf /var/lib/apt/lists/*
# Install Node.js (LTS version)
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -y nodejs && \
npm install -g pnpm@8.3.1 pm2 ts-node
# Install dufs
RUN DUF_VER=$(curl -sL https://api.github.com/repos/sigoden/dufs/releases/latest | grep tag_name | cut -d'"' -f4) && \
wget -qO /tmp/dufs.tar.gz "https://github.com/sigoden/dufs/releases/download/${DUF_VER}/dufs-${DUF_VER}-x86_64-unknown-linux-musl.tar.gz" && \
tar xzf /tmp/dufs.tar.gz -C /usr/local/bin/ dufs && \
chmod +x /usr/local/bin/dufs && \
rm -f /tmp/dufs.tar.gz
# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh -
# Create a user to run code-server
RUN useradd -m -s /bin/zsh coder && \
echo 'coder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Create code-server configuration directory
RUN mkdir -p /home/coder/.local/share/code-server/User && \
chmod -R 777 /home/coder && \
echo '{ \
"workbench.colorTheme": "Default Dark Modern", \
"telemetry.enableTelemetry": true, \
"telemetry.enableCrashReporter": true \
}' > /home/coder/.local/share/code-server/User/settings.json && \
chown -R coder:coder /home/coder/.local/share/code-server
# Install Python extension for code-server
RUN sudo -u coder code-server --install-extension ms-python.python
# Copy config files
COPY --chown=coder:coder start_server.sh /home/coder/
COPY nginx.conf /etc/nginx/nginx.conf
RUN chmod +x /home/coder/start_server.sh
ENV HOME=/home/coder \
PATH=/home/coder/.local/bin:$PATH
WORKDIR /home/coder
EXPOSE 7860
CMD ["sh", "-c", "/home/coder/start_server.sh"]