Skip to content
Permalink
Browse files

docker file

  • Loading branch information...
bordeux committed Jan 24, 2019
1 parent 5514b81 commit a44ba423e8981c406d22a929caec18f10adf0214
Showing with 44 additions and 0 deletions.
  1. +1 −0 .dockerignore
  2. +22 −0 Dockerfile
  3. +21 −0 run-server.sh
@@ -0,0 +1 @@
.git
@@ -0,0 +1,22 @@
FROM golang:alpine

MAINTAINER Krzysztof Bednarczyk <admin@bordeux.net>

ENV MODLISHKA_REPOSITORY="github.com/drk1wi/Modlishka"
ENV INSTALL_PACKAGES="git make gcc musl-dev"
ENV PROJECT_DIR="${GOPATH}/src/${MODLISHKA_REPOSITORY}"
ENV MODLISHKA_BIN="/bin/proxy"

COPY ./run-server.sh /bin/run-server.sh
ADD . ${PROJECT_DIR}

RUN set -ex \
&& chmod +x /bin/run-server.sh \
&& apk add --no-cache ${INSTALL_PACKAGES}\
&& cd ${PROJECT_DIR}/ && make \
&& cp ${PROJECT_DIR}/dist/proxy ${MODLISHKA_BIN} \
&& apk del ${INSTALL_PACKAGES} && rm -rf /var/cache/apk/* && rm -rf ${GOPATH}/src/*

CMD ["run-server.sh"]

EXPOSE 80 443
@@ -0,0 +1,21 @@
#!/bin/sh
set -e

RUN_CMD='${MODLISHKA_BIN}'
IFS='
'
envList=$(env)
for line in $envList
do
envName=$(echo "${line}" | cut -d'=' -f 1 | tr '[:upper:]' '[:lower:]')
if [[ "${envName:0:3}" = "ml_" ]] ;
then
optionName=$(echo "${envName}" | sed -r 's/(^ml\_)//g' |awk -F'_' '{ printf $1; for(i=2; i<=NF; i++) printf toupper(substr($i,1,1)) substr($i,2);printf "\n"}')
optionValue=$(echo "${line}" | sed -r 's/(^.*)\=//g')
RUN_CMD="${RUN_CMD} -${optionName} ${optionValue}"
fi
done

echo "Running command: ${RUN_CMD}"

sh -c $RUN_CMD

0 comments on commit a44ba42

Please sign in to comment.
You can’t perform that action at this time.