Skip to content

Commit

Permalink
Backup and restore bash profile
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Woffenden <[email protected]>
  • Loading branch information
Jacob Woffenden committed Mar 13, 2024
1 parent 047e248 commit b64c5c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ RUN apt-get update --yes \
"python3-pip=22.0.2+dfsg-1ubuntu0.4" \
"unzip=6.0-26ubuntu3.2" \
&& apt-get clean --yes \
&& rm --force --recursive /var/lib/apt/lists/*
&& rm --force --recursive /var/lib/apt/lists/* \
&& install --directory --owner ${CONTAINER_USER} --group ${CONTAINER_GROUP} --mode 0755 /opt/visual-studio-code

COPY src/opt/visual-studio-code/first-run-notice.txt /opt/visual-studio-code/first-run-notice.txt
# Backup Bash configuration
RUN cp /home/analyticalplatform/.bashrc /opt/visual-studio-code/.bashrc \
&& cp /home/analyticalplatform/.bash_logout /opt/visual-studio-code/.bash_logout \
&& cp /home/analyticalplatform/.profile /opt/visual-studio-code/.profile

# First run notice
COPY src/opt/visual-studio-code/first-run-notice.txt /opt/visual-studio-code/first-run-notice.txt
RUN cat <<EOF >> /etc/bash.bashrc

# This is a first run notice for Visual Studio Code
Expand Down
5 changes: 5 additions & 0 deletions src/usr/local/bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

# Restore Bash configuration
cp /opt/visual-studio-code/.bashrc /home/analyticalplatform/.bashrc
cp /opt/visual-studio-code/.bash_logout /home/analyticalplatform/.bash_logout
cp /opt/visual-studio-code/.profile /home/analyticalplatform/.profile

mkdir --parent /home/analyticalplatform/workspace

/usr/bin/code serve-web \
Expand Down
18 changes: 18 additions & 0 deletions test/container-structure-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,21 @@ fileContentTests:
- name: "bashrc first-run-notice"
path: "/etc/bash.bashrc"
expectedContents: ["# This is a first run notice for Visual Studio Code"]

fileExistenceTests:
- name: "/opt/visual-studio-code"
path: "/opt/visual-studio-code"
shouldExist: true

- name: "/opt/visual-studio-code/.bashrc"
path: "/opt/visual-studio-code/.bashrc"
shouldExist: true

- name: "/opt/visual-studio-code/.bash_logout"
path: "/opt/visual-studio-code/.bash_logout"
shouldExist: true

- name: "/opt/visual-studio-code/.profile"
path: "/opt/visual-studio-code/.profile"
shouldExist: true

0 comments on commit b64c5c8

Please sign in to comment.