mirror of
https://github.com/vbatts/imgsrv.git
synced 2024-12-24 23:06:31 +00:00
dockerfile: trying a different approach for entrypoint
This commit is contained in:
parent
b3f5e06c4d
commit
be4ac4b880
2 changed files with 25 additions and 6 deletions
|
@ -8,9 +8,4 @@ RUN dnf install -y golang git bzr && \
|
|||
go get github.com/vbatts/imgsrv && \
|
||||
rm -rf /usr/local/src /usr/local/pkg && \
|
||||
dnf remove -y golang git bzr
|
||||
ENTRYPOINT /usr/local/bin/imgsrv \
|
||||
-server \
|
||||
-mongo-host=$MONGODB_SERVICE_HOST:$MONGODB_SERVICE_PORT \
|
||||
-mongo-db=$MONGODB_DATABASE \
|
||||
-mongo-username=$DATABASE_USER \
|
||||
-mongo-password=$DATABASE_PASSWORD
|
||||
ENTRYPOINT ["/usr/local/src/github.com/vbatts/imgsrv/run.sh"]
|
||||
|
|
24
run.sh
Normal file
24
run.sh
Normal 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}
|
Loading…
Reference in a new issue