Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Build docker image. Add run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
greboid committed Dec 2, 2018
1 parent d131c31 commit e4bfb62
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
13 changes: 13 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 9 deletions run.sh
Original file line number Diff line number Diff line change
@@ -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.