This commit is contained in:
Jackson Delahunt 2019-01-13 11:58:21 +11:00
parent 6044f7db4f
commit 9e58e5f85d
4 changed files with 27 additions and 7 deletions

View file

@ -1,13 +1,19 @@
FROM stemn/development-environment:latest
USER root
ARG CONTAINER_BUILD_DATE
ARG CONTAINER_GIT_SHA
ENV BASE_USER stemn
ENV CONTAINER_BUILD_DATE $CONTAINER_BUILD_DATE
ENV CONTAINER_GIT_SHA $CONTAINER_GIT_SHA
ENV USER jackson
ENV HOME /$USER/home
ENV SSH_AUTH_SOCK=/ssh-auth.sock
ENV STEMN_GIT_EMAIL="jackson@stemn.com"
ENV STEMN_GIT_NAME="Jackson Delahunt"
RUN echo $CONTAINER_BUILD_DATE
# Keep the existing home directory
RUN mkdir /$USER && \
mv /$BASE_USER/home $HOME
@ -73,16 +79,13 @@ RUN git clone https://github.com/sabrehagen/dotfiles-vcsh
RUN git clone https://github.com/sabrehagen/dotfiles-zsh
# Add program configurations
COPY config/tmuxinator/.desktop.yaml $HOME/.tmuxinator/desktop.yaml
COPY config/tmuxinator $HOME/.config/tmuxinator
COPY config/zsh/.zshenv $HOME/.zshenv.desktop
RUN echo 'source .zshenv.desktop' >> $HOME/.zshenv
# Add custom binaries
COPY bin /usr/local/bin
# Extend existing shell configuration
RUN echo 'cd $HOME/repositories/stemn/stemn-backend' >> $HOME/.zshenv
RUN echo 'export $STEMN_TMUX_SESSION=desktop-environment' >> $HOME/.zshenv
RUN echo 'tmux new-session -d -s $STEMN_TMUX_SESSION tmuxinator desktop' >> $HOME/.zshenv
# Remove root ownership of all files under non-root user directory
RUN chown -R $USER:$USER $HOME

13
config/zsh/.zshenv Normal file
View file

@ -0,0 +1,13 @@
# Print container build info
CURRENT_DATE=$(date +%s)
TIME_SINCE_CONTAINER_BUILD=$(echo $((CURRENT_DATE-CONTAINER_BUILD_DATE)) | awk '{print int($1/60)":"int($1%60)}')
echo "Container built: $CONTAINER_BUILD_DATE ($TIME_SINCE_CONTAINER_BUILD ago) | sha $CONTAINER_GIT_SHA"
# Change to most used directory
cd $HOME/repositories/stemn/stemn-backend
# Always connect to the desktop-environment session
export $STEMN_TMUX_SESSION=desktop-environment
# Start the desktop-environment session if it isn't already started
tmux new-session -d -s $STEMN_TMUX_SESSION tmuxinator desktop

View file

@ -1,3 +1,7 @@
REPO_ROOT=$(dirname $(realpath $0))/..
docker build -t sabrehagen/desktop-environment:latest $REPO_ROOT
docker build \
--build-arg CONTAINER_BUILD_DATE=$(date +%s) \
--build-arg CONTAINER_GIT_SHA=$(git rev-parse HEAD | cut -b 1-7) \
--tag sabrehagen/desktop-environment:latest \
$REPO_ROOT