# Use the codercom/code-server image
FROM codercom/code-server:latest
MAINTAINER steven velozo

VOLUME /home/coder/.config
VOLUME /home/coder/.vscode

RUN echo "...installing debian dependencies..."
RUN sudo apt update
RUN sudo apt install vim curl tmux -y

RUN echo "Building development image..."

RUN echo "...installing vscode extensions..."

# Mocha unit testing in the sidebar
RUN code-server --install-extension hbenl.vscode-mocha-test-adapter
RUN code-server --install-extension hbenl.test-adapter-converter
RUN code-server --install-extension hbenl.vscode-test-explorer

# Magic indentation rainbow
RUN code-server --install-extension oderwat.indent-rainbow
RUN code-server --install-extension dbaeumer.vscode-eslint

# Contextual git
RUN code-server --install-extension eamodio.gitlens

# Other extensions (uncomment them to have them automagic, or run this from a terminal to install in the container):

# Microsoft's AI code completion
# RUN code-server --install-extension  VisualStudioExptTeam.vscodeintellicode

# Live server -- make sure to open up the port on the docker image
# RUN code-server --install-extension ritwickdey.LiveServer

# Quick link to required modules' documentation
# RUN code-server --install-extension bengreenier.vscode-node-readme

# Switch up fonts
# RUN code-server --install-extension evan-buss.font-switcher

# Icons
# RUN code-server --install-extension vscode-icons-team.vscode-icons
# RUN code-server --install-extension PKief.material-icon-theme

# Hover over CSS colors to see them previewed
# RUN code-server --install-extension bierner.color-info

# An easy on the eyes color theme
# RUN code-server --install-extension daylerees.rainglow

RUN echo "...mapping library specific volumes..."

# Volume mapping for code
VOLUME /home/coder/orator

SHELL ["/bin/bash", "-c"]
USER coder

RUN echo "...installing node version manager..."
# Because there is a .bashrc chicken/egg problem, we will create one here to simulate logging in.  This is not great.
RUN touch ~/.bashrc && chmod +x ~/.bashrc
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

RUN echo "...installing node version 14 as the default..."
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm install 14
RUN . ~/.nvm/nvm.sh && source ~/.bashrc && nvm alias default 14

WORKDIR /home/coder/orator
