Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ceres-c
Last active November 1, 2022 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceres-c/962f83bf7957ddab536e677aff0d4f06 to your computer and use it in GitHub Desktop.
Save ceres-c/962f83bf7957ddab536e677aff0d4f06 to your computer and use it in GitHub Desktop.
Simple dockerfile to run vscode in a container
FROM greyltc/archlinux-aur:latest
ARG VSCODE_USER="user"
ARG VSCODE_PASS="password"
RUN pacman -Sy --noconfirm openssh alsa-lib jdk11-openjdk tmux sshfs zsh nano noto-fonts noto-fonts-emoji ttf-linux-libertine
RUN aur-install visual-studio-code-bin burpsuite-pro
RUN useradd "$VSCODE_USER" --system --create-home
RUN echo "$VSCODE_USER:$VSCODE_PASS" | chpasswd
RUN gpasswd -a "$VSCODE_USER" wheel
RUN echo "%wheel ALL=(ALL:ALL) ALL" >> /etc/sudoers
RUN chown -R "$VSCODE_USER:$VSCODE_USER" /mnt
ENV _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"
ENV QT_X11_NO_MITSHM=1
# Stop vscode from complaining about being run as root (I DON'T CARE)
RUN sed -i -e '$s,$, --no-sandbox --user-data-dir /home/user/.config/Code,' /usr/bin/code
USER "$VSCODE_USER"
COPY --chown="$VSCODE_USER:$VSCODE_USER" storage.json /home/"$VSCODE_USER"/.config/Code/storage.json
COPY --chown="$VSCODE_USER:$VSCODE_USER" keybindings.json /home/"$VSCODE_USER"/.config/Code/User/keybindings.json
COPY --chown="$VSCODE_USER:$VSCODE_USER" settings.json /home/"$VSCODE_USER"/.config/Code/User/settings.json
# cp $HOME/.config/Code/storage.json .
# cp $HOME/.config/Code/User/keybindings.json .
# cp $HOME/.config/Code/User/settings.json .
# docker build -t vscode .
# xhost + # to allow X11 forwarding (UNSAFE)
# docker run -it --rm --privileged --net=host -e DISPLAY=$DISPLAY vscode
# xhost -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment