Permalink
Browse files

Docker docker docker docker docker

  • Loading branch information...
csmith committed Dec 17, 2017
1 parent ed28564 commit dbc1ecda90f6189c202993a6b84848b9f833008b
Showing with 32 additions and 0 deletions.
  1. +3 −0 README.md
  2. +11 −0 docker/Dockerfile
  3. +4 −0 docker/entrypoint.sh
  4. +14 −0 run.sh
@@ -4,6 +4,9 @@ This repository contains my solution to 2017's [Advent of Code](https://adventof
are all written in Python 3; one or two may require the [NumPy](http://www.numpy.org/) package, but the rest should
work out-of-the-box.

If you have docker installed, simply execute `run.sh` to build a docker image and execute the latest solution
using pypy3. You can specify other days by passing the script names as arguments (e.g. `run.sh 03.py`).

I tend to focus on short, functional solutions where possible, so they may be a bit hard to read. Some solutions are
commented to some degree to help with that.

@@ -0,0 +1,11 @@
FROM pypy:3

RUN pip3 install numpy

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

USER nobody

CMD /entrypoint.sh
VOLUME /code
@@ -0,0 +1,4 @@
#!/bin/bash

cd /code
time pypy3 ${1:-$(find -regex './[0-9]+.py' | sort | tail -n 1)}
14 run.sh
@@ -0,0 +1,14 @@
#!/bin/bash

IMAGE=csmith/aoc-2017-01

docker image inspect $IMAGE >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "One time setup: building docker image..."
cd docker
docker build . -t $IMAGE
cd ..
fi

docker run --rm -it -v $(pwd):/code $IMAGE /entrypoint.sh $@

0 comments on commit dbc1ecd

Please sign in to comment.