Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Add first-run message to terminal (#17)
Browse files Browse the repository at this point in the history
* πŸ§‘β€πŸ’» Add first-run message to container

* βœ… Add testing
  • Loading branch information
Gary-H9 authored Feb 28, 2024
1 parent 39c2bb6 commit 4702024
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF >> /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 \
Expand Down
8 changes: 8 additions & 0 deletions src/opt/visual-studio-code/first-run-notice.txt
Original file line number Diff line number Diff line change
@@ -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).

5 changes: 5 additions & 0 deletions test/container-structure-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 4702024

Please sign in to comment.