Just Run It

William Bartlett Email: w.bartlett@treeptik.fr Twitter: @bartlettstarman LinkedIn: punkstarman GitHub: punkstarman

28th March 2019

Just Run It

Don’t install Just run docker run

Let’s meet

William Bartlett, Treeptik

  • Agile Coach, Dev
  • Docker enthusiast
  • Windows detractor

“Use the right tool for the job”

A Day in the Life

I work on many projects using various technologies and versions of them.

So?

Problem

How do you work with varying tech stacks without going mad?

Solution

Use containers!

It’s not Docker’s 2nd birthday

We know

$ sudo apt install mysql
$ docker run mysql
$ docker-compose up -d

Really?

$ docker run ... maven

Outline

  • Related Solutions
  • Maven Wrapper
  • Haskell Stack
  • LaTeX Presentation

Source Code

All source code at https://gitlab.com/namrats/talks/just-run-it

Related Solutions

Related Solutions

  • Workstation as Code w/Ansible
  • Virtualization w/Vagrant
  • Virtualenv/Pipenv for Python
  • NPM for Node
  • Cloud IDE w/Eclipse Che

Maven Wrapper

Maven Wrapper

Requirements

  • Shell
  • Docker
UID=$(id -u)
GID=$(id -g)

MAVEN_VERSION="3.6.0-jdk-8-alpine"
MAVEN_OPTS="-Duser.home=/var/maven"

exec docker run -it --rm -u $UID:$GID \
 -v $HOME/.m2:/var/maven/.m2 \
 -v $PWD:/usr/src/$(basename $PWD) \
 -w /usr/src/$(basename $PWD) \
 -e HOME=/var/maven \
 -e MAVEN_CONFIG=/var/maven/.m2 \
 maven:$MAVEN_VERSION mvn $MAVEN_OPTS "$@"

Maven Wrapper

Concerns

  • Caching w/volume

Difficulties

  • IDE integration

Haskell Stack

Haskell Stack

Requirements

  • Shell
  • Docker
  • Stack

stack.yaml

resolver: lts-13.14

docker:
  enable: true

Haskell Stack

Concerns

  • IDE integration w/LSP

Difficulties

  • Image size

LaTeX Presentation

LaTeX Presentation

Requirements

  • Shell
  • Docker
  • Make
DOCKERFLAGS=-it --rm -u $(UID):$(GID) \
 -v $(LUATEX_CACHE):$(LUATEX_CACHE) \
 -v $(CURDIR)/fonts:/usr/local/share/fonts \
 -v $(CURDIR):/data \
 -w /data \
 -e HOME=/tmp

TEX_SCRIPT=for run in $$(seq 2) ; \
 do $(TEX) $(TEXFLAGS) $< ; \
 done

$(PROJECT_NAME).pdf: main.tex *.tex $(LUATEX_CACHE)
    docker run $(DOCKERFLAGS) $(DOCKERIMAGE) \
      sh -c '$(TEX_SCRIPT)'

LaTeX Presentation

Concerns

  • Caching w/volume

Difficulties

  • IDE integration

Conclusion

Conclusion

  • Wrapper shell script
  • Tool integration
  • Makefile

Future work

  • More tool integration, please
  • containerized desktop apps (IDE)