Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Backup and restore Bash profile #27

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Loading