mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Merge from vscode 2cd495805cf99b31b6926f08ff4348124b2cf73d
This commit is contained in:
committed by
AzureDataStudio
parent
a8a7559229
commit
1388493cc1
121
.devcontainer/Dockerfile
Normal file
121
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,121 @@
|
||||
#-------------------------------------------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
|
||||
#-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-10
|
||||
|
||||
ARG TARGET_DISPLAY=":1"
|
||||
|
||||
# VNC options
|
||||
ARG MAX_VNC_RESOLUTION=1920x1080x16
|
||||
ARG TARGET_VNC_RESOLUTION=1920x1080
|
||||
ARG TARGET_VNC_DPI=72
|
||||
ARG TARGET_VNC_PORT=5901
|
||||
ARG VNC_PASSWORD="vscode"
|
||||
|
||||
# noVNC (VNC web client) options
|
||||
ARG INSTALL_NOVNC="true"
|
||||
ARG NOVNC_VERSION=1.1.0
|
||||
ARG TARGET_NOVNC_PORT=6080
|
||||
ARG WEBSOCKETIFY_VERSION=0.9.0
|
||||
|
||||
# Firefox is useful for testing things like browser launch events, but optional
|
||||
ARG INSTALL_FIREFOX="false"
|
||||
|
||||
# Expected non-root username from base image
|
||||
ARG USERNAME=node
|
||||
|
||||
# Core environment variables for X11, VNC, and fluxbox
|
||||
ENV DBUS_SESSION_BUS_ADDRESS="autolaunch:" \
|
||||
MAX_VNC_RESOLUTION="${MAX_VNC_RESOLUTION}" \
|
||||
VNC_RESOLUTION="${TARGET_VNC_RESOLUTION}" \
|
||||
VNC_DPI="${TARGET_VNC_DPI}" \
|
||||
VNC_PORT="${TARGET_VNC_PORT}" \
|
||||
NOVNC_PORT="${TARGET_NOVNC_PORT}" \
|
||||
DISPLAY="${TARGET_DISPLAY}" \
|
||||
LANG="en_US.UTF-8" \
|
||||
LANGUAGE="en_US.UTF-8" \
|
||||
VISUAL="nano" \
|
||||
EDITOR="nano"
|
||||
|
||||
# Configure apt and install packages
|
||||
RUN apt-get update \
|
||||
&& export DEBIAN_FRONTEND=noninteractive \
|
||||
#
|
||||
# Install the Cascadia Code fonts - https://github.com/microsoft/cascadia-code
|
||||
&& curl -sSL https://github.com/microsoft/cascadia-code/releases/download/v2004.30/CascadiaCode_2004.30.zip -o /tmp/cascadia-fonts.zip \
|
||||
&& unzip /tmp/cascadia-fonts.zip -d /tmp/cascadia-fonts \
|
||||
&& mkdir -p /usr/share/fonts/truetype/cascadia \
|
||||
&& mv /tmp/cascadia-fonts/ttf/* /usr/share/fonts/truetype/cascadia/ \
|
||||
&& rm -rf /tmp/cascadia-fonts.zip /tmp/cascadia-fonts \
|
||||
#
|
||||
# Install X11, fluxbox and VS Code dependencies
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
xvfb \
|
||||
x11vnc \
|
||||
fluxbox \
|
||||
dbus-x11 \
|
||||
x11-utils \
|
||||
x11-xserver-utils \
|
||||
xdg-utils \
|
||||
fbautostart \
|
||||
xterm \
|
||||
eterm \
|
||||
gnome-terminal \
|
||||
gnome-keyring \
|
||||
seahorse \
|
||||
nautilus \
|
||||
libx11-dev \
|
||||
libxkbfile-dev \
|
||||
libsecret-1-dev \
|
||||
libnotify4 \
|
||||
libnss3 \
|
||||
libxss1 \
|
||||
libasound2 \
|
||||
xfonts-base \
|
||||
xfonts-terminus \
|
||||
fonts-noto \
|
||||
fonts-wqy-microhei \
|
||||
fonts-droid-fallback \
|
||||
vim-tiny \
|
||||
nano \
|
||||
#
|
||||
# [Optional] Install noVNC
|
||||
&& if [ "${INSTALL_NOVNC}" = "true" ]; then \
|
||||
mkdir -p /usr/local/novnc \
|
||||
&& curl -sSL https://github.com/novnc/noVNC/archive/v${NOVNC_VERSION}.zip -o /tmp/novnc-install.zip \
|
||||
&& unzip /tmp/novnc-install.zip -d /usr/local/novnc \
|
||||
&& cp /usr/local/novnc/noVNC-${NOVNC_VERSION}/vnc_lite.html /usr/local/novnc/noVNC-${NOVNC_VERSION}/index.html \
|
||||
&& rm /tmp/novnc-install.zip \
|
||||
&& curl -sSL https://github.com/novnc/websockify/archive/v${WEBSOCKETIFY_VERSION}.zip -o /tmp/websockify-install.zip \
|
||||
&& unzip /tmp/websockify-install.zip -d /usr/local/novnc \
|
||||
&& apt-get -y install --no-install-recommends python-numpy \
|
||||
&& ln -s /usr/local/novnc/websockify-${WEBSOCKETIFY_VERSION} /usr/local/novnc/noVNC-${NOVNC_VERSION}/utils/websockify \
|
||||
&& rm /tmp/websockify-install.zip; \
|
||||
fi \
|
||||
#
|
||||
# [Optional] Install Firefox
|
||||
&& if [ "${INSTALL_FIREFOX}" = "true" ]; then \
|
||||
apt-get -y install --no-install-recommends firefox-esr; \
|
||||
fi \
|
||||
#
|
||||
# Clean up
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY bin/init-dev-container.sh /usr/local/share/
|
||||
COPY bin/set-resolution /usr/local/bin/
|
||||
COPY fluxbox/* /root/.fluxbox/
|
||||
COPY fluxbox/* /home/${USERNAME}/.fluxbox/
|
||||
|
||||
# Update privs, owners of config files
|
||||
RUN mkdir -p /var/run/dbus /root/.vnc /home/${USERNAME}/.vnc \
|
||||
&& touch /root/.Xmodmap /home/${USERNAME}/.Xmodmap \
|
||||
&& echo "${VNC_PASSWORD}" | tee /root/.vnc/passwd > /home/${USERNAME}/.vnc/passwd \
|
||||
&& chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.Xmodmap /home/${USERNAME}/.fluxbox /home/${USERNAME}/.vnc \
|
||||
&& chmod +x /usr/local/share/init-dev-container.sh /usr/local/bin/set-resolution
|
||||
|
||||
ENTRYPOINT ["/usr/local/share/init-dev-container.sh"]
|
||||
CMD ["sleep", "infinity"]
|
||||
82
.devcontainer/README.md
Normal file
82
.devcontainer/README.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Code - OSS Development Container
|
||||
|
||||
This repository includes configuration for a development container for working with Code - OSS in an isolated local container or using [Visual Studio Codespaces](https://aka.ms/vso).
|
||||
|
||||
> **Tip:** The default VNC password is `vscode`. The VNC server runs on port `5901` with a web client at `6080`. For better performance, we recommend using a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/). Applications like the macOS Screen Sharing app will not perform as well. [Chicken](https://sourceforge.net/projects/chicken/) is a good macOS alternative.
|
||||
|
||||
## Quick start - local
|
||||
|
||||
1. Install Docker Desktop or Docker on your local machine. (See [docs](https://aka.ms/vscode-remote/containers/getting-started) for additional details.)
|
||||
|
||||
2. [Docker Desktop] If you are not using the new WSL2 Docker Desktop engine, increase the resources allocated to Docker Desktop to at least **4 Cores and 4 GB of RAM (8 GB recommended)**. Right-click on the Docker status bar item, go to **Preferences/Settings > Resources > Advanced** to do so.
|
||||
|
||||
> **Note:** The [Resource Monitor](https://marketplace.visualstudio.com/items?itemName=mutantdino.resourcemonitor) extension is included in the container so you can keep an eye on CPU/Memory in the status bar.
|
||||
|
||||
3. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [Remote - Containers](https://aka.ms/vscode-remote/download/containers) extension.
|
||||
|
||||

|
||||
|
||||
> Note that the Remote - Containers extension requires the Visual Studio Code distribution of Code - OSS. See the [FAQ](https://aka.ms/vscode-remote/faq/license) for details.
|
||||
|
||||
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select **Remote - Containers: Open Repository in Container...**.
|
||||
|
||||
> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or using the Hyper-V engine on Windows. We recommend the "open repository" approach instead since it uses "named volume" rather than the local filesystem.
|
||||
|
||||
5. Type `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
|
||||
|
||||
6. After the container is running, open a web browser and go to [http://localhost:6080](http://localhost:6080) or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
|
||||
|
||||
Anything you start in VS Code or the integrated terminal will appear here.
|
||||
|
||||
Next: **[Try it out!](#try-it)**
|
||||
|
||||
## Quick start - Codespaces
|
||||
|
||||
>Note that the Codespaces browser-based editor cannot currently access the desktop environment in this container (due to a [missing feature](https://github.com/MicrosoftDocs/vsonline/issues/117)). We recommend using Visual Studio Code from the desktop to connect instead in the near term.
|
||||
|
||||
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [Visual Studio Codespaces](https://aka.ms/vscs-ext-vscode) extension.
|
||||
|
||||

|
||||
|
||||
> Note that the Visual Studio Codespaces extension requires the Visual Studio Code distribution of Code - OSS.
|
||||
|
||||
2. Sign in by pressing <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and selecting **Codespaces: Sign In**. You may also need to use the **Codespaces: Create Plan** if you do not have a plan. See the [Codespaces docs](https://aka.ms/vso-docs/vscode) for details.
|
||||
|
||||
3. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select **Codespaces: Create New Codespace**.
|
||||
|
||||
4. Use default settings, select a plan, and then enter the repository URL `https://github.com/microsoft/vscode` (or a branch or PR URL) in the input box when prompted.
|
||||
|
||||
5. After the container is running, open a web browser and go to [http://localhost:6080](http://localhost:6080) or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
|
||||
|
||||
6. Anything you start in VS Code or the integrated terminal will appear here.
|
||||
|
||||
## Try it!
|
||||
|
||||
This container uses the [Fluxbox](http://fluxbox.org/) window manager to keep things lean. **Right-click on the desktop** to see menu options. It works with GNOME and GTK applications, so other tools can be installed if needed.
|
||||
|
||||
Note you can also set the resolution from the command line by typing `set-resolution`.
|
||||
|
||||
To start working with Code - OSS, follow these steps:
|
||||
|
||||
1. In your local VS Code, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
bash scripts/code.sh
|
||||
```
|
||||
|
||||
2. After the build is complete, open a web browser and go to [http://localhost:6080](http://localhost:6080) or use a [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to `localhost:5901` and enter `vscode` as the password.
|
||||
|
||||
3. You should now see Code - OSS!
|
||||
|
||||
Next, let's try debugging.
|
||||
|
||||
1. Shut down Code - OSS by clicking the box in the upper right corner of the Code - OSS window through your browser or VNC viewer.
|
||||
|
||||
2. Go to your local VS Code client, and use Run / Debug view to launch the **VS Code** configuration. (Typically the default, so you can likely just press <kbd>F5</kbd>).
|
||||
|
||||
> **Note:** If launching times out, you can increase the value of `timeout` in the "VS Code", "Attach Main Process", "Attach Extension Host", and "Attach to Shared Process" configurations in [launch.json](../.vscode/launch.json). However, running `scripts/code.sh` first will set up Electron which will usually solve timeout issues.
|
||||
|
||||
3. After a bit, Code - OSS will appear with the debugger attached!
|
||||
|
||||
Enjoy!
|
||||
91
.devcontainer/bin/init-dev-container.sh
Normal file
91
.devcontainer/bin/init-dev-container.sh
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
NONROOT_USER=node
|
||||
LOG=/tmp/container-init.log
|
||||
|
||||
# Execute the command it not already running
|
||||
startInBackgroundIfNotRunning()
|
||||
{
|
||||
log "Starting $1."
|
||||
echo -e "\n** $(date) **" | sudoIf tee -a /tmp/$1.log > /dev/null
|
||||
if ! pidof $1 > /dev/null; then
|
||||
keepRunningInBackground "$@"
|
||||
while ! pidof $1 > /dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
log "$1 started."
|
||||
else
|
||||
echo "$1 is already running." | sudoIf tee -a /tmp/$1.log > /dev/null
|
||||
log "$1 is already running."
|
||||
fi
|
||||
}
|
||||
|
||||
# Keep command running in background
|
||||
keepRunningInBackground()
|
||||
{
|
||||
($2 sh -c "while :; do echo [\$(date)] Process started.; $3; echo [\$(date)] Process exited!; sleep 5; done 2>&1" | sudoIf tee -a /tmp/$1.log > /dev/null & echo "$!" | sudoIf tee /tmp/$1.pid > /dev/null)
|
||||
}
|
||||
|
||||
# Use sudo to run as root when required
|
||||
sudoIf()
|
||||
{
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
sudo "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Use sudo to run as non-root user if not already running
|
||||
sudoUserIf()
|
||||
{
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
sudo -u ${NONROOT_USER} "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Log messages
|
||||
log()
|
||||
{
|
||||
echo -e "[$(date)] $@" | sudoIf tee -a $LOG > /dev/null
|
||||
}
|
||||
|
||||
log "** SCRIPT START **"
|
||||
|
||||
# Start dbus.
|
||||
log 'Running "/etc/init.d/dbus start".'
|
||||
if [ -f "/var/run/dbus/pid" ] && ! pidof dbus-daemon > /dev/null; then
|
||||
sudoIf rm -f /var/run/dbus/pid
|
||||
fi
|
||||
sudoIf /etc/init.d/dbus start 2>&1 | sudoIf tee -a /tmp/dbus-daemon-system.log > /dev/null
|
||||
while ! pidof dbus-daemon > /dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Set up Xvfb.
|
||||
startInBackgroundIfNotRunning "Xvfb" sudoIf "Xvfb ${DISPLAY:-:1} +extension RANDR -screen 0 ${MAX_VNC_RESOLUTION:-1920x1080x16}"
|
||||
|
||||
# Start fluxbox as a light weight window manager.
|
||||
startInBackgroundIfNotRunning "fluxbox" sudoUserIf "dbus-launch startfluxbox"
|
||||
|
||||
# Start x11vnc
|
||||
startInBackgroundIfNotRunning "x11vnc" sudoIf "x11vnc -display ${DISPLAY:-:1} -rfbport ${VNC_PORT:-5901} -localhost -no6 -xkb -shared -forever -passwdfile $HOME/.vnc/passwd"
|
||||
|
||||
# Set resolution
|
||||
/usr/local/bin/set-resolution ${VNC_RESOLUTION:-1280x720} ${VNC_DPI:-72}
|
||||
|
||||
|
||||
# Spin up noVNC if installed and not runnning.
|
||||
if [ -d "/usr/local/novnc" ] && [ "$(ps -ef | grep /usr/local/novnc/noVNC*/utils/launch.sh | grep -v grep)" = "" ]; then
|
||||
keepRunningInBackground "noVNC" sudoIf "/usr/local/novnc/noVNC*/utils/launch.sh --listen ${NOVNC_PORT:-6080} --vnc localhost:${VNC_PORT:-5901}"
|
||||
log "noVNC started."
|
||||
else
|
||||
log "noVNC is already running or not installed."
|
||||
fi
|
||||
|
||||
# Run whatever was passed in
|
||||
log "Executing \"$@\"."
|
||||
"$@"
|
||||
log "** SCRIPT EXIT **"
|
||||
25
.devcontainer/bin/set-resolution
Normal file
25
.devcontainer/bin/set-resolution
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
RESOLUTION=${1:-${VNC_RESOLUTION:-1920x1080}}
|
||||
DPI=${2:-${VNC_DPI:-72}}
|
||||
if [ -z "$1" ]; then
|
||||
echo -e "**Current Settings **\n"
|
||||
xrandr
|
||||
echo -n -e "\nEnter new resolution (WIDTHxHEIGHT, blank for ${RESOLUTION}, Ctrl+C to abort).\n> "
|
||||
read NEW_RES
|
||||
if [ "${NEW_RES}" != "" ]; then
|
||||
RESOLUTION=${NEW_RES}
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
echo -n -e "\nEnter new DPI (blank for ${DPI}, Ctrl+C to abort).\n> "
|
||||
read NEW_DPI
|
||||
if [ "${NEW_DPI}" != "" ]; then
|
||||
DPI=${NEW_DPI}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
xrandr --fb ${RESOLUTION} --dpi ${DPI} > /dev/null 2>&1
|
||||
|
||||
echo -e "\n**New Settings **\n"
|
||||
xrandr
|
||||
echo
|
||||
41
.devcontainer/devcontainer.json
Normal file
41
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "Code - OSS",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
"MAX_VNC_RESOLUTION": "1920x1080x16",
|
||||
"TARGET_VNC_RESOLUTION": "1280x768",
|
||||
"TARGET_VNC_PORT": "5901",
|
||||
"TARGET_NOVNC_PORT": "6080",
|
||||
"VNC_PASSWORD": "vscode",
|
||||
"INSTALL_FIREFOX": "true"
|
||||
}
|
||||
},
|
||||
"overrideCommand": false,
|
||||
"runArgs": ["--init"],
|
||||
|
||||
"settings": {
|
||||
// zsh is also available
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"resmon.show.battery": false,
|
||||
"resmon.show.cpufreq": false,
|
||||
"remote.extensionKind": {
|
||||
"ms-vscode.js-debug-nightly": "workspace",
|
||||
"msjsdiag.debugger-for-chrome": "workspace"
|
||||
},
|
||||
"debug.chrome.useV3": true
|
||||
},
|
||||
|
||||
// noVNC, VNC ports
|
||||
"forwardPorts": [6080, 5901],
|
||||
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"EditorConfig.EditorConfig",
|
||||
"msjsdiag.debugger-for-chrome",
|
||||
"mutantdino.resourcemonitor",
|
||||
"GitHub.vscode-pull-request-github"
|
||||
],
|
||||
|
||||
"remoteUser": "node"
|
||||
}
|
||||
9
.devcontainer/fluxbox/apps
Normal file
9
.devcontainer/fluxbox/apps
Normal file
@@ -0,0 +1,9 @@
|
||||
[app] (name=code-oss-dev)
|
||||
[Position] (CENTER) {0 0}
|
||||
[Maximized] {yes}
|
||||
[Dimensions] {100% 100%}
|
||||
[end]
|
||||
[transient] (role=GtkFileChooserDialog)
|
||||
[Position] (CENTER) {0 0}
|
||||
[Dimensions] {70% 70%}
|
||||
[end]
|
||||
9
.devcontainer/fluxbox/init
Normal file
9
.devcontainer/fluxbox/init
Normal file
@@ -0,0 +1,9 @@
|
||||
session.menuFile: ~/.fluxbox/menu
|
||||
session.keyFile: ~/.fluxbox/keys
|
||||
session.styleFile: /usr/share/fluxbox/styles//Squared_for_Debian
|
||||
session.configVersion: 13
|
||||
session.screen0.workspaces: 1
|
||||
session.screen0.workspacewarping: false
|
||||
session.screen0.toolbar.widthPercent: 100
|
||||
session.screen0.strftimeFormat: %d %b, %a %02k:%M:%S
|
||||
session.screen0.toolbar.tools: prevworkspace, workspacename, nextworkspace, clock, prevwindow, nextwindow, iconbar, systemtray
|
||||
16
.devcontainer/fluxbox/menu
Normal file
16
.devcontainer/fluxbox/menu
Normal file
@@ -0,0 +1,16 @@
|
||||
[begin] ( Code - OSS Development Container )
|
||||
[exec] (File Manager) { nautilus ~ } <>
|
||||
[exec] (Terminal) {/usr/bin/gnome-terminal --working-directory=~ } <>
|
||||
[exec] (Start Code - OSS) { x-terminal-emulator -T "Code - OSS Build" -e bash /workspaces/vscode*/scripts/code.sh } <>
|
||||
[submenu] (System >) {}
|
||||
[exec] (Set Resolution) { x-terminal-emulator -T "Set Resolution" -e bash /usr/local/bin/set-resolution } <>
|
||||
[exec] (Passwords and Keys) { seahorse } <>
|
||||
[exec] (Top) { x-terminal-emulator -T "Top" -e /usr/bin/top } <>
|
||||
[exec] (Editres) {editres} <>
|
||||
[exec] (Xfontsel) {xfontsel} <>
|
||||
[exec] (Xkill) {xkill} <>
|
||||
[exec] (Xrefresh) {xrefresh} <>
|
||||
[end]
|
||||
[config] (Configuration >)
|
||||
[workspaces] (Workspaces >)
|
||||
[end]
|
||||
Reference in New Issue
Block a user