diff --git a/Dockerfile b/Dockerfile index e257f6a..7ebfa22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,21 @@ RUN apt-get update --yes \ && apt-get clean --yes \ && rm --force --recursive /var/lib/apt/lists/* -# Visaual Studio Code +COPY src/opt/visual-studio-code/first-run-notice.txt /opt/visual-studio-code/first-run-notice.txt + +RUN cat <> /home/analyticalplatform/.bashrc + +# This is a first run notice for Visual Studio Code +if [ -t 1 ] && [[ "\${TERM_PROGRAM}" = "vscode" ]] && [ ! -f "/opt/visual-studio-code/first-run-notice-already-displayed" ]; then + cat /opt/visual-studio-code/first-run-notice.txt + # Mark first run notice as displayed after 10s to avoid problems with fast terminal refreshes hiding it + mkdir -p "~/.visual-studio-code" + ((sleep 10s; touch "~/.visual-studio-code/first-run-notice-already-displayed") &) +fi + +EOF + +# Visual Studio Code RUN curl --location --fail-with-body \ "https://packages.microsoft.com/keys/microsoft.asc" \ --output microsoft.asc \ diff --git a/src/opt/visual-studio-code/first-run-notice.txt b/src/opt/visual-studio-code/first-run-notice.txt new file mode 100644 index 0000000..10c63d5 --- /dev/null +++ b/src/opt/visual-studio-code/first-run-notice.txt @@ -0,0 +1,8 @@ +👋 Welcome! You are using the Ministry of Justice Analytical Platform Visual Studio Code image. + +🧪 This feature is currently in Beta. + +🆘 If you need help or assistance, please post a message into the analytical-platform-vscode-beta Slack Channel. + +🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1). + diff --git a/test/container-structure-test.yml b/test/container-structure-test.yml index 7e6bdb6..cd0fc80 100644 --- a/test/container-structure-test.yml +++ b/test/container-structure-test.yml @@ -38,3 +38,8 @@ commandTests: command: "pip" args: ["--version"] expectedOutput: ["pip.*"] + +fileContentTests: + - name: "bashrc first-run-notice" + path: "/home/analyticalplatform/.bashrc" + expectedContents: ["# This is a first run notice for Visual Studio Code"]