Skip to content

Commit 785e08e

Browse files
committed
Docker benchmarking for Shane
1 parent b83392d commit 785e08e

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

docker.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
IMAGE=cnorthwood/aoc
4+
5+
docker image inspect $IMAGE >/dev/null 2>&1
6+
if [ $? -ne 0 ]
7+
then
8+
echo "One time setup: building docker image..."
9+
cd docker
10+
docker build . -t $IMAGE
11+
cd ..
12+
fi
13+
14+
docker run --rm -it $IMAGE /entrypoint.sh $@

docker/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM pypy:3
2+
3+
ADD entrypoint.sh /entrypoint.sh
4+
RUN chmod +x /entrypoint.sh
5+
RUN mkdir /code
6+
RUN chown nobody /code
7+
8+
USER nobody
9+
10+
RUN git clone https://github.com/cnorthwood/adventofcode.git /code
11+
CMD /entrypoint.sh

docker/entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set +ex
4+
5+
YEAR="${1}"
6+
DAY="${2}"
7+
8+
cd /code
9+
git pull
10+
git checkout ${YEAR}day${DAY}
11+
12+
time sh -c './part1.py; ./part2.py'

0 commit comments

Comments
 (0)