1
0
Fork 0
mirror of https://github.com/vbatts/imgsrv.git synced 2024-12-25 23:36:30 +00:00

dockerfile: trying a different approach for entrypoint

This commit is contained in:
Vincent Batts 2017-06-07 18:49:51 -04:00
parent b3f5e06c4d
commit be4ac4b880
2 changed files with 25 additions and 6 deletions

View file

@ -8,9 +8,4 @@ RUN dnf install -y golang git bzr && \
go get github.com/vbatts/imgsrv && \ go get github.com/vbatts/imgsrv && \
rm -rf /usr/local/src /usr/local/pkg && \ rm -rf /usr/local/src /usr/local/pkg && \
dnf remove -y golang git bzr dnf remove -y golang git bzr
ENTRYPOINT /usr/local/bin/imgsrv \ ENTRYPOINT ["/usr/local/src/github.com/vbatts/imgsrv/run.sh"]
-server \
-mongo-host=$MONGODB_SERVICE_HOST:$MONGODB_SERVICE_PORT \
-mongo-db=$MONGODB_DATABASE \
-mongo-username=$DATABASE_USER \
-mongo-password=$DATABASE_PASSWORD

24
run.sh Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
binary=${APP_BINARY:-/usr/local/bin/imgsrv}
MONGODB_SERVICE_HOST=${MONGODB_SERVICE_HOST:-localhost}
MONGODB_SERVICE_PORT=${MONGODB_SERVICE_PORT:-27017}
args=""
if [ ! -z "${DATABASE_USER}" ] ; then
args=" ${args} -mongo-username=$DATABASE_USER "
fi
if [ ! -z "${DATABASE_PASSWORD}" ] ; then
args=" ${args} -mongo-password=$DATABASE_PASSWORD "
fi
if ! echo "${1:-$@}" | grep -q '\-mongo-host' ; then
args=" ${args} -mongo-host=$MONGODB_SERVICE_HOST:$MONGODB_SERVICE_PORT "
fi
${binary} \
-server \
-mongo-db=$MONGODB_DATABASE \
${1:-$@} \
${args}