Permalink
Browse files

Build docker image. Add run.sh

  • Loading branch information...
greboid committed Dec 2, 2018
1 parent d131c31 commit e4bfb6295085e27c7b8c63dcbb6af44f0851bfc7
Showing with 31 additions and 9 deletions.
  1. +10 −0 Dockerfile
  2. +13 −0 entrypoint.sh
  3. +8 −9 run.sh
@@ -0,0 +1,10 @@
FROM alpine:3.8
COPY entrypoint.sh /entrypoint.sh
WORKDIR /app
RUN apk add --no-cache php7 && \
chmod +x /entrypoint.sh && \
chown -R nobody:nobody /entrypoint.sh

USER nobody

ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,13 @@
#!/bin/sh
if [ $# -eq 1 ]; then
php $1/a.php
php $1/b.php
exit 1
elif [ $# -eq 2 ]; then
php $1/$2.php
exit 1
else
echo "Need some parameters."
fi

exec "$@"
17 run.sh
@@ -1,10 +1,9 @@
#!/bin/sh
if [ $# -eq 1 ]; then
docker run --rm -it -v $PWD:/app -w /app php:7.3-rc-cli php $1/a.php
docker run --rm -it -v $PWD:/app -w /app php:7.3-rc-cli php $1/b.php
exit 1
fi
if [ $# -eq 2 ]; then
docker run --rm -it -v $PWD:/app -w /app php:7.3-rc-cli php $1/$2.php
exit 1
#!/bin/bash
IMAGE=greboid/aoc-2018
docker image inspect $IMAGE >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "One time setup: building docker image..."
docker build . -t $IMAGE
fi
docker run --rm -it -v $(pwd):/app $IMAGE $@

0 comments on commit e4bfb62

Please sign in to comment.