Just Run It

A presentation at Docker Birthday #6 in March 2019 in Aix-en-Provence, France by William Bartlett

Slide 1

Slide 1

Just Run It

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

28th March 2019

Slide 2

Slide 2

Just Run It

Don’t install Just run docker run

Slide 3

Slide 3

Let’s meet

William Bartlett, Treeptik

  • Agile Coach, Dev
  • Docker enthusiast
  • Windows detractor

“Use the right tool for the job”

Slide 4

Slide 4

A Day in the Life

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

Slide 5

Slide 5

So?

Problem

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

Solution

Use containers!

Slide 6

Slide 6

It’s not Docker’s 2nd birthday

Slide 7

Slide 7

We know

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

Really?

$ docker run ... maven

Slide 8

Slide 8

Outline

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

Slide 9

Slide 9

Source Code

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

Slide 10

Slide 10

Related Solutions

Slide 11

Slide 11

Related Solutions

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

Slide 12

Slide 12

Maven Wrapper

Slide 13

Slide 13

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

Slide 14

Slide 14

Maven Wrapper

Concerns

  • Caching w/volume

Difficulties

  • IDE integration

Slide 15

Slide 15

Haskell Stack

Slide 16

Slide 16

Haskell Stack

Requirements

  • Shell
  • Docker
  • Stack

stack.yaml

resolver: lts-13.14

docker:
  enable: true

Slide 17

Slide 17

Haskell Stack

Concerns

  • IDE integration w/LSP

Difficulties

  • Image size

Slide 18

Slide 18

LaTeX Presentation

Slide 19

Slide 19

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)'

Slide 20

Slide 20

LaTeX Presentation

Concerns

  • Caching w/volume

Difficulties

  • IDE integration

Slide 21

Slide 21

Conclusion

Slide 22

Slide 22

Conclusion

  • Wrapper shell script
  • Tool integration
  • Makefile

Future work

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