Browse Source

Add Dockerfile to run dev env in an image

This is a large, 2.8GB image, but doable!
clean-shoes
ViViDboarder 3 days ago
parent
commit
5401bd67c6
  1. 34
      Dockerfile
  2. 4
      Makefile
  3. 19
      docker-devenv.sh

34
Dockerfile

@ -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

4
Makefile

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

19
docker-devenv.sh

@ -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
Loading…
Cancel
Save