Skip to content

Commit

Permalink
Improve dev container with ZSH support.
Browse files Browse the repository at this point in the history
  • Loading branch information
KeesCBakker committed Nov 4, 2024
1 parent d60a633 commit ee164d2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# colors
NC='\033[0m' # no color
YELLOW='\033[1;33m'

# echo start instructions
echo -e "To start your bot-zero instance, please enter: ${YELLOW}npm run dev${NC}"
echo ""
14 changes: 11 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Start with the same base image
FROM mcr.microsoft.com/devcontainers/javascript-node:0-18-bullseye
FROM mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm

# Upgrade NPM
RUN npm install -g npm@9.6.7
RUN npm install -g npm@10.9.0 --no-audit --no-fund

# Install global packages
RUN npm install --no-audit --no-fund --global \
npm-check-updates

COPY ./startup.sh /
RUN chmod +x /startup.sh
RUN chmod +x /startup.sh

# Copy bash profile, if you copy it directly
# you'll lose your colors :-(
COPY ./.profile /tmp/.profile
RUN cat /tmp/.profile >> /home/node/.bashrc && \
cat /tmp/.profile >> /home/node/.zshrc && \
rm /tmp/.profile

19 changes: 3 additions & 16 deletions .devcontainer/startup.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/bin/sh

set -e

# trust the repo
# fixes:
# - fatal: detected dubious ownership in repository at '/workspaces/bot-zero'.
git config --global --unset-all safe.directory > /dev/null 2>&1
git config --global --add safe.directory "$PWD"

# config local GPG for signing
# fixes:
# - error: cannot run C:\Program Files (x86)\Gpg4win..\GnuPG\bin\gpg.exe: No such file or directory.
git config --global gpg.program gpg

# install NPM packages
echo ""
echo "Installing packages..."
Expand All @@ -21,14 +19,3 @@ if [ ! -f .env ]; then
echo "Copying .example.env to .env..."
cp .example.env .env
fi

# colors
NC='\033[0m' # no color
BLUE='\033[1;34m'
YELLOW='\033[1;33m'

# echo start instructions
echo ""
echo ""
echo "${BLUE}To start your bot-zero instance, please enter: ${YELLOW}npm run dev${NC}"
echo ""

0 comments on commit ee164d2

Please sign in to comment.