-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
220 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
GIT_BRANCH_COLOR_CLEAN=$(tput setaf 2) | ||
GIT_BRANCH_COLOR_DIRTY=$(tput setaf 1) | ||
BOLD=$(tput bold) | ||
NORM=$(tput sgr0) | ||
NO_COLOR=$(tput sgr0) | ||
|
||
parse_git_branch() | ||
{ | ||
branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/') | ||
|
||
if [[ -n $branch ]] | ||
then | ||
if [ -n "$(git status --untracked-files=no --porcelain)" ] | ||
then | ||
# Uncommitted changes | ||
branch+='*' | ||
echo "${GIT_BRANCH_COLOR_DIRTY}${BOLD}${branch}${NORM}${NO_COLOR}" | ||
else | ||
echo "${GIT_BRANCH_COLOR_CLEAN}${branch}${NO_COLOR}" | ||
fi | ||
fi | ||
} | ||
|
||
export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]\[\033[01;34m\] \w\[\$(parse_git_branch)\]\[\e[00m\]\n> " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,75 @@ | ||
FROM ubuntu:23.04 | ||
FROM ubuntu:24.04 | ||
|
||
ARG ENV_FILE=/home/ubuntu/.env_setup | ||
ARG project_dir=/home/ubuntu/project | ||
ARG ruby_version=3.1.4 | ||
ARG node_version=16.13.2 | ||
|
||
ENV RUBY_VERSION=${ruby_version} | ||
ENV NODE_VERSION=${node_version} | ||
|
||
RUN \ | ||
apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
curl \ | ||
git \ | ||
ca-certificates \ | ||
ruby-full \ | ||
build-essential \ | ||
openssh-client \ | ||
sudo \ | ||
zlib1g-dev | ||
|
||
# Disable password prompt for sudo commands | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
USER ubuntu | ||
WORKDIR /home/ubuntu | ||
WORKDIR ${project_dir} | ||
|
||
RUN \ | ||
curl -sSL https://get.rvm.io | bash -s stable && \ | ||
/home/ubuntu/.rvm/bin/rvm install ${ruby_version} && \ | ||
/home/ubuntu/.rvm/bin/rvm use ${ruby_version} | ||
|
||
RUN \ | ||
echo "#!/bin/bash" >> $ENV_FILE && \ | ||
echo "export GEM_HOME=/home/ubuntu/gems" >> $ENV_FILE && \ | ||
echo "export GEM_PATH=/home/ubuntu/gems" >> $ENV_FILE && \ | ||
echo "export NVM_DIR=/home/ubuntu/.nvm" >> $ENV_FILE && \ | ||
echo "export PATH=\"/home/ubuntu/gems/bin:$PATH\"" >> $ENV_FILE && \ | ||
echo '[ -s $NVM_DIR/nvm.sh ] && \. $NVM_DIR/nvm.sh || true' >> $ENV_FILE | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | ||
|
||
COPY \ | ||
.devcontainer/.git_branch_bash \ | ||
/home/ubuntu | ||
|
||
# Temporarily add Makefile, Gemfile and NPM package files so that installation is done during | ||
# the container build phase. | ||
ADD \ | ||
|
||
RUN mkdir ${project_dir}/scripts | ||
|
||
COPY \ | ||
Makefile \ | ||
Gemfile \ | ||
Gemfile.lock \ | ||
package.json \ | ||
package-lock.json \ | ||
/home/ubuntu | ||
${project_dir} | ||
|
||
COPY \ | ||
scripts/env_setup.sh \ | ||
${project_dir}/scripts | ||
|
||
RUN \ | ||
sudo chown ubuntu:ubuntu \ | ||
/home/ubuntu/package.json \ | ||
/home/ubuntu/package-lock.json \ | ||
&& \ | ||
sudo chmod 666 \ | ||
Gemfile.lock \ | ||
package-lock.json && \ | ||
make install && \ | ||
rm \ | ||
/home/ubuntu/Makefile \ | ||
/home/ubuntu/Gemfile \ | ||
/home/ubuntu/Gemfile.lock \ | ||
/home/ubuntu/package.json \ | ||
/home/ubuntu/package-lock.json | ||
rm Makefile \ | ||
Gemfile \ | ||
Gemfile.lock \ | ||
package.json \ | ||
package-lock.json && \ | ||
rm -rf ${project_dir}/scripts | ||
|
||
RUN \ | ||
tee -a /home/ubuntu/.bashrc <<EOF | ||
alias mkc='make clean' | ||
source /home/ubuntu/.git_branch_bash | ||
source /usr/share/bash-completion/completions/git | ||
EOF | ||
|
||
EXPOSE 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
{ | ||
"name": "Shantea Controls Website", | ||
"dockerComposeFile": [ | ||
"../docker-compose-build.yml" | ||
], | ||
"service": "shanteacontrols-website", | ||
"workspaceFolder": "/home/ubuntu/website", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"llvm-vs-code-extensions.vscode-clangd", | ||
"eamodio.gitlens", | ||
"xaver.clang-format", | ||
"timonwong.shellcheck" | ||
] | ||
} | ||
} | ||
"name": "${localWorkspaceFolderBasename}", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "${localWorkspaceFolder}" | ||
}, | ||
"workspaceMount": "src=${localWorkspaceFolder},dst=/home/ubuntu/project,type=bind", | ||
"workspaceFolder": "/home/ubuntu/project", | ||
"mounts": [ | ||
{ | ||
"source": "${localEnv:HOME}/.gitconfig", | ||
"target": "/etc/gitconfig", | ||
"type": "bind" | ||
}, | ||
{ | ||
"source": "${localEnv:HOME}/.ssh", | ||
"target": "/home/ubuntu/.ssh", | ||
"type": "bind" | ||
} | ||
], | ||
"runArgs": [ | ||
"--network=host", | ||
"--hostname=${localWorkspaceFolderBasename}", | ||
], | ||
"containerUser": "ubuntu", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-vscode.cpptools", | ||
"llvm-vs-code-extensions.vscode-clangd", | ||
"eamodio.gitlens", | ||
"xaver.clang-format", | ||
"timonwong.shellcheck" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.