2021-10-18 04:38:10 -07:00
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/go/.devcontainer/base.Dockerfile
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster
ARG VARIANT = 1 -bullseye
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION = "none"
RUN if [ " ${ NODE_VERSION } " != "none" ] ; then su vscode -c " umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${ NODE_VERSION } 2>&1 " ; fi
2021-11-20 04:45:51 -08:00
# Download and register the Microsoft repository GPG keys
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm -f packages-microsoft-prod.deb
2021-10-18 04:38:10 -07:00
# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND = noninteractive \
2021-11-20 04:45:51 -08:00
&& apt-get install -y --no-install-recommends \
fish \
powershell \
2021-11-26 03:41:33 -08:00
fzf \
2021-11-20 04:45:51 -08:00
&& apt-get clean
2021-10-18 04:38:10 -07:00
2021-11-26 03:02:28 -08:00
ARG USERNAME = vscode
2021-11-20 04:45:51 -08:00
2021-11-26 03:02:28 -08:00
# Download the oh-my-posh binary
RUN mkdir /home/${ USERNAME } /bin; \
export ARCH = ` uname -m` ; \
2021-11-20 04:45:51 -08:00
if [ [ " $ARCH " -eq "aarch64" ] ] ; then \
2021-11-26 03:02:28 -08:00
export POSH_BIN = "posh-linux-arm64" ; \
2021-11-20 04:45:51 -08:00
elif [ [ " $ARCH " -eq "armv7l" ] ] ; then \
2021-11-26 03:02:28 -08:00
export POSH_BIN = "posh-linux-arm" ; \
2021-11-20 04:45:51 -08:00
else \
2021-11-26 03:02:28 -08:00
export POSH_BIN = "posh-linux-amd64" ; \
2021-11-20 04:45:51 -08:00
fi ; \
2021-11-26 03:02:28 -08:00
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/${ POSH_BIN } -O /home/${ USERNAME } /bin/oh-my-posh; \
chmod +x /home/${ USERNAME } /bin/oh-my-posh; \
chown ${ USERNAME } : /home/${ USERNAME } /bin;
2021-11-20 04:45:51 -08:00
# NOTE: devcontainers are Linux-only at this time but when
# Windows or Darwin is supported someone will need to improve
# the code logic above.
2021-11-26 03:41:33 -08:00
# Setup a neat little PowerShell experience
RUN pwsh -Command Install-Module posh-git -Scope AllUsers -Force; \
pwsh -Command Install-Module z -Scope AllUsers -Force; \
pwsh -Command Install-Module PSFzf -Scope AllUsers -Force; \
pwsh -Command Install-Module Terminal-Icons -Scope AllUsers -Force;
2021-11-26 03:02:28 -08:00
# add the oh-my-posh path to the PATH variable
ENV PATH " $PATH : ${ USERNAME } /bin "
2021-11-20 04:45:51 -08:00
# Can be used to override the devcontainer prompt default theme:
2021-11-26 03:02:28 -08:00
ENV POSH_THEME = "/workspaces/oh-my-posh/themes/jandedobbeleer.omp.json"
2021-11-20 04:45:51 -08:00
# Deploy oh-my-posh prompt to Powershell:
COPY Microsoft.PowerShell_profile.ps1 /home/${ USERNAME } /.config/powershell/Microsoft.PowerShell_profile.ps1
# Deploy oh-my-posh prompt to Fish:
COPY config.fish /home/${ USERNAME } /.config/fish/config.fish
# Everything runs as root during build time, so we want
# to make sure the vscode user can edit these paths too:
RUN chmod 777 -R /home/${ USERNAME } /.config
# Override vscode's own Bash prompt with oh-my-posh:
RUN sed -i 's/^__bash_prompt$/#&/' /home/${ USERNAME } /.bashrc && \
2021-11-26 03:02:28 -08:00
echo " eval \"\$(oh-my-posh --init --shell bash --config $POSH_THEME )\" " >> /home/${ USERNAME } /.bashrc
2021-11-20 04:45:51 -08:00
# Override vscode's own ZSH prompt with oh-my-posh:
2021-11-26 03:02:28 -08:00
RUN echo " eval \"\$(oh-my-posh --init --shell zsh --config $POSH_THEME )\" " >> /home/${ USERNAME } /.zshrc
2021-11-20 04:45:51 -08:00
# Set container timezone:
ARG TZ = "UTC"
RUN ln -sf /usr/share/zoneinfo/${ TZ } /etc/localtime
2021-10-18 04:38:10 -07:00
# [Optional] Uncomment the next line to use go get to install anything else you need
# RUN go get -x github.com/JanDeDobbeleer/battery
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1