Skip to content

Commit

Permalink
Add custom docker image for ci build
Browse files Browse the repository at this point in the history
Try to mirror my system and it's hacks in the docker image.
  • Loading branch information
creichert committed Nov 11, 2018
1 parent 28151d8 commit 87056b9
Show file tree
Hide file tree
Showing 9 changed files with 483 additions and 30 deletions.
36 changes: 22 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ jobs:
build:
working_directory: ~/dotfiles/dotfiles
docker:
- image: assertible/ci
- image: creichert/debian
steps:
- checkout

- run: apt update
- run: |
apt install -y --no-install-recommends \
xvfb xinit x11-xserver-utils \
xserver-xorg libx11-dev \
git libxrandr-dev libxft-dev \
libxml2-dev

# While this is not recommended in general, but for my system integration
# I always want packages to work w/ the latest debian/sid packages.
- run: apt upgrade

- run: apt install stow emacs -y --no-install-recommends

Expand All @@ -23,22 +21,32 @@ jobs:
# remove pre-existing dotfiles (stow will not)
- run: rm ~/.profile ~/.bashrc ~/.gitconfig

- restore_cache:
keys:
- v1-dotcache-{{ .Branch }}
- v1-dotcache

- run: make dotfiles
- run: xvfb-run make dotemacs

- run: xvfb-run make theme
- run: xvfb-run make fonts

- restore_cache:
keys:
- v1-dotcache-{{ .Branch }}
- v1-dotcache

- run: xvfb-run make xmonad

- save_cache:
key: v1-dotcache-{{ .Branch }}
paths:
- ~/.stack/

# - run: cd $HOME && xvfb-run startx
- ~/.emacs.d/elpa

- run: make xflux

# NOTE can't run systemd inside circle ci containers (yet) as cgroup
# passthrough is needed.
#
#- run: xvfb-run systemd-analyze --user verify xflux.service
#- run: xvfb-run systemd-analyze --user verify unclutter.service
#- run: xvfb-run systemd-analyze --user verify xscreensaver.service
#
#- run: cd $HOME && xvfb-run startx
173 changes: 173 additions & 0 deletions .circleci/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
## -*- dockerfile-image-name: "creichert/debian" -*-
## -*- dockerfile-build-args: '("debian_mirror_url=http://127.0.0.1:3142/debian.csail.mit.edu/debian" "node_version=9.7.1") -*-

# This is almost an exact copy of my workstation setup.
#
# The idea behind recreating my local setup in this Docker image is to
# run CI against my "real" machine and codify a lot of the small hacks
# I use on my workstation.
#
# To see what's installed on Debian / Ubuntu through APT, you can
# $ awk -vRS= '/Status: install/ {print $2}' /var/lib/dpkg/status | grep systemd

FROM assertible/debian-min:unstable

ENV DEBIAN_FRONTEND noninteractive
ENV SHELL /bin/bash

ARG debian_mirror_url=http://httpredir.debian.org/debian
RUN printf "deb %s sid main contrib\n" ${debian_mirror_url} > /etc/apt/sources.list
RUN printf "deb-src %s sid main contrib\n" ${debian_mirror_url} >> /etc/apt/sources.list
RUN cat /etc/apt/sources.list
RUN apt-get update

# Configure utf-8 system locale
RUN apt-get install -y --no-install-recommends \
locales

RUN locale-gen en_US.UTF-8 en_us && \
dpkg-reconfigure locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8

RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8


RUN apt-get install -y --no-install-recommends \
systemd \
systemd-container \
systemd-sysv

# I use curl & libcurl-dev extensively
RUN apt-get install -y --no-install-recommends \
openssl \
libssl1.1 \
ca-certificates \
curl

# Build dependencies
RUN apt-get install -y --no-install-recommends \
libgmp10 \
libgmp-dev \
make \
xz-utils \
libpq5 \
libpq-dev \
libpcre3 \
libpcre3-dev \
zlib1g-dev \
gcc

# Javascript dependencies
RUN apt-get install -y --no-install-recommends \
fontconfig \
pkg-config \
bzip2

# CI utilities
#
# Wishlist:
# - vim
# - less
RUN apt-get install -y --no-install-recommends \
awscli \
zip \
jq \
git \
shellcheck \
openssh-client \
openssh-server \
docker.io

# x11
RUN apt-get install -y --no-install-recommends \
xvfb \
xinit \
x11-xserver-utils \
xserver-xorg \
xscreensaver \
unclutter \
libx11-dev \
libxrandr-dev \
libxft-dev


# mpris / spotify / dunst
RUN apt-get install -y --no-install-recommends \
dbus-x11 \
dbus-user-session
# spotify


RUN apt-get install -y --no-install-recommends \
emacs


RUN apt-get install -y --no-install-recommends \
msmtp \
pass


# Notifications
RUN apt-get install -y --no-install-recommends \
libnotify-bin \
dunst

# Audio
RUN apt-get install -y --no-install-recommends \
pulseaudio \
pulseaudio-utils \
alsa-utils


# dev utils
RUN apt-get install -y --no-install-recommends \
xmlstarlet \
libxml2

RUN apt-get -y autoremove
RUN apt-get -y autoclean

# emacs & emacs dev libs for hacking
RUN apt-get -y build-dep emacs

# Install nvm
#
# - https://gist.github.com/remarkablemark/aacf14c29b3f01d6900d13137b21db3a#file-dockerfile
ENV NVM_DIR /usr/local/nvm
ARG node_version=9.7.1
ENV NODE_VERSION ${node_version}
ENV NVM_INSTALL_URL https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh
RUN curl --silent -o- $NVM_INSTALL_URL | bash

# Install node and npm

RUN . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default

# add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

# Install stack
ENV STACK_INSTALL_URL https://github.com/commercialhaskell/stack/releases/download/v1.9.1/stack-1.9.1-linux-x86_64.tar.gz
RUN curl -L $STACK_INSTALL_URL -o /tmp/stack.tar.gz
RUN tar -xvzf /tmp/stack.tar.gz
RUN cp stack-1.9.1-linux-x86_64/stack /usr/local/bin/stack
RUN rm -rf stack-1.9.1-linux-x86_64 /tmp/stack.tar.gz


# Print software versions
RUN uname -snrvm
RUN stack --version
RUN node -v
RUN npm -v

# Use container cmd suitable for CI environment
CMD bash
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# this is a folder designed for you to keep
dotlocal/
bin/bin/xflux

# hide ".$somerc.local" configs. They are used to store private files and
# configurations not synced to github.
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ theme: submodules

@-xrdb -query | grep -v '^$$'

xscreensaver-command -restart
@# TODO
@#dunst_xr_theme_changer.sh
@#mv ~/.config/dunst/dunstrc_xr_colors x11/.config/dunst/dunstrc

-xscreensaver-command -restart

themes-list: submodules
@echo
Expand Down
19 changes: 19 additions & 0 deletions bash/.bash_functions
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,22 @@ function bootstrap_lang() {

esac
}

function dunst-toggle-notifications() {

case "$1" in
# Node
on)
notify-send DUNST_COMMAND_RESUME
notify-send "enabling dunst"
export DUNST_ENABLED=1
;;
off)
notify-send "pausing dunst"
notify-send DUNST_COMMAND_PAUSE
export DUNST_ENABLED=0
;;
*)
echo $"Usage: $0 {on|pff}"
esac
}
Loading

0 comments on commit 87056b9

Please sign in to comment.