Add Dockerfile to run dev env in an image

This is a large, 2.8GB image, but doable!
This commit is contained in:
ViViDboarder 2021-06-09 17:07:15 -07:00
parent feeb17fd00
commit 5401bd67c6
3 changed files with 57 additions and 0 deletions

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM ubuntu:hirsute
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends sudo
RUN useradd -m vividboarder
RUN echo "vividboarder:vividboarder" | chpasswd
RUN adduser vividboarder sudo
VOLUME /home/vividboarder
ENV HOME /home/vividboarder
RUN mkdir /shoestrap
WORKDIR /shoestrap
COPY ./helpers ./helpers
COPY ./ansible-cookbook ./
RUN mkdir -p ./recipes/default ./assets/default
COPY ./recipes/default/packages ./recipes/default/
RUN ./ansible-cookbook default packages
COPY ./recipes/default/vim-settings ./recipes/default/
RUN ./ansible-cookbook default vim-settings
COPY . .
RUN ./ansible-cookbook default dotfiles
RUN ./ansible-cookbook default bin
RUN ./ansible-cookbook default fish
RUN ./ansible-cookbook default git
RUN chown -R vividboarder:vividboarder /home/vividboarder
USER vividboarder
WORKDIR /home/vividboarder

View File

@ -9,3 +9,7 @@ install-hooks:
.PHONY: test .PHONY: test
test: test:
pre-commit run --all-files pre-commit run --all-files
.PHONY: docker-build
docker-build:
docker build . -t devenv-$(USER)

19
docker-devenv.sh Executable file
View File

@ -0,0 +1,19 @@
#! /bin/bash
image_name=devenv-$(whoami)
container_name=$image_name-run
if ! docker inspect "$container_name" > /dev/null ; then
echo "start new"
docker run -it \
--hostname="$(hostname)-docker" \
--env SSH_CLIENT=true \
--env TERM_PROGRAM="$TERM_PROGRAM" \
--env ITERM_PROFILE="$ITERM_PROFILE" \
--volume /:/host \
--name "$container_name" \
"$image_name" fish
else
echo "start existing"
docker start --attach --interactive "$container_name"
fi