Skip to content

Commit

Permalink
maint: update Docker dotfiles Dockerfile and build/run make targets
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
  • Loading branch information
vladdoster committed May 13, 2022
1 parent 6deaae7 commit 19ddf30
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 29 deletions.
34 changes: 21 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# FROM debian:latest
FROM ubuntu:18.04

# syntax=docker.io/docker/dockerfile:1
FROM --platform=linux/amd64 amd64/ubuntu:18.04
LABEL maintainer="Vladislav Doster <mvdoster@gmail.com>"

ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "[INFO]: running on $BUILDPLATFORM, building for $TARGETPLATFORM"

ARG _USER="vlad"
ARG _UID="1001"
ARG _GID="100"
Expand Down Expand Up @@ -31,37 +34,42 @@ RUN apt-get update \
nmap neovim \
pkg-config python3 \
ruby \
unzip \
sudo stow subversion \
tmux \
xz \
unzip \
zsh \
&& apt-get dist-upgrade \
--no-install-recommends \
-o Dpkg::Options::="--force-confold" \
-y

RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
# Update Locales
RUN apt-get install -y locales \
&& rm -rf /var/lib/apt/lists/* \
&& localedef \
-A /usr/share/locale/locale.alias \
-c \
-f UTF-8 \
-i en_US \
en_US.UTF-8
ENV LANG en_US.utf8

RUN useradd -m -s "$(which zsh)" -N -u "${UID}" "${USER}" \
&& echo "$USER:root" | chpasswd \
&& usermod -aG sudo ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& echo "${USER} ALL=(ALL) ALL" > "/etc/sudoers.d/${USER}" \
&& chmod 0440 /etc/sudoers.d/"${USER}"
&& chmod 0440 /etc/sudoers.d/"${USER}" \
&& chsh --shell $(which zsh) ${USER}

USER ${USER}
WORKDIR $HOME

RUN /bin/bash -c "\
RUN /bin/bash -c " \
mkdir ${HOME}/.config \
&& git clone https://github.com/vladdoster/dotfiles ${HOME}/.config/dotfiles \
&& pushd ${HOME}/.config/dotfiles \
&& make brew-install \
&& make install \
&& make \
&& popd"

CMD ["/bin/zsh"]
37 changes: 21 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ $(CONFIGS): ## Clone a program's configuration repository
install: | clean neovim ## Deploy dotfiles via GNU install
find * -maxdepth 0 -type d -exec stow --verbose 1 {} --target $$HOME \;

container/build: ## Build container && install dotfiles
docker volume create configuration
docker buildx build \
--no-cache \
--output=type=docker \
--platform linux/amd64 \
--tag=$(CONTAINER_NAME):latest \
$$PWD
$(info --- built df container)

container/run: ## Run containerized dockerfiles env
$(info --- starting df container)
docker run \
--interactive \
--tty \
--user vlad \
--volume configuration:/home/vlad \
$(CONTAINER_NAME)

brew-install: ## Install Homebrew
@/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Expand Down Expand Up @@ -76,26 +95,12 @@ stow: ## Install GNU stow
rm -rf stow
$(info --- installed GNU stow)

container/build: ## Build container && install dotfiles
docker build --tag $(CONTAINER_NAME):latest $$PWD
$(info --- built df container)

container/run: ## Run containerized dockerfiles env
mkdir -p $$HOME/df-docker-volume || true
$(info --- starting df container)
docker volume create configuration
docker run \
--interactive \
--tty \
--user vlad \
--volume configuration:/home/vlad \
$(CONTAINER_NAME):latest

.SILENT: clean
clean: ## Remove deployed dotfiles
find "$$PWD" -type f -name "*.DS_Store" -print -delete
$(info --- cleaned .DS_Store files)
find * -maxdepth 0 -type d -exec stow --verbose 1 --target $$HOME --delete {} \;
$(info --- removed linked dotfiles)
rm -rf $HOME/{.cache,.config/nvim/lua/packer_compiled.lua,.local/share/nvim}
$(info --- removed files generated by nvim & zsh)

.SILENT: brew-install clean container/build container/run stow

0 comments on commit 19ddf30

Please sign in to comment.