diff --git a/docker/webapp/Dockerfile b/docker/webapp/Dockerfile index 5d375dc4..a26ae8c6 100755 --- a/docker/webapp/Dockerfile +++ b/docker/webapp/Dockerfile @@ -1,26 +1,28 @@ FROM apheleia/swoole:latest USER root RUN dnf -y install findutils gnupg2 git rsync && \ dnf clean all EXPOSE 8000 ARG GIT_REF=master ARG GIT_REMOTE=https://git.kolab.org/source/kolab.git ARG CONFIG=config.prod +ARG OVERLAY_GIT_REMOTE +ARG OVERLAY_GIT_REF=master #Set this to prod or dev ARG RELEASE_MODE=prod COPY build.sh /build.sh RUN /build.sh && \ chgrp -R 0 /opt/app-root /tmp && \ chmod -R g=u /opt/app-root /tmp && \ chown -R 1001:0 /opt/app-root /tmp COPY init.sh /init.sh COPY update.sh /update.sh USER 1001 CMD [ "/init.sh" ] diff --git a/docker/webapp/build.sh b/docker/webapp/build.sh index 25736f7f..239bf8c1 100755 --- a/docker/webapp/build.sh +++ b/docker/webapp/build.sh @@ -1,46 +1,51 @@ #!/bin/bash set -e set -x echo -e "Building with the following ulimit: limit: $(ulimit -n)\n" echo -e "If you run into EMFILE errors, this is the reason" mkdir /src cd /src function checkout() { if [ ! -d "$1" ]; then git clone "$2" "$1" pushd "$1" git checkout "$3" popd fi } checkout kolab $GIT_REMOTE $GIT_REF -pushd kolab -#TODO support injecting a custom overlay into the build process here -bin/configure.sh $CONFIG -# In the docker-compose case we copy the .env file during the init phase, otherwise we use the environment for configuration. -rm src/.env -popd +# We either apply a remote overlay, or one of the built in deployment configs. +if [[ -z $OVERLAY_GIT_REMOTE ]]; then + pushd kolab + bin/configure.sh $CONFIG + # In the docker-compose case we copy the .env file during the init phase, otherwise we use the environment for configuration. + rm src/.env + popd +else + checkout overlay $OVERLAY_GIT_REMOTE $OVERLAY_GIT_REF + rsync -av overlay/src/ kolab/src/ +fi rm -rf /opt/app-root/src cp -a kolab/src /opt/app-root/src cd /opt/app-root/src/ mkdir -p storage/framework/{sessions,views,cache} mkdir -p database/seeds php -dmemory_limit=-1 $(command -v composer) install npm -g install npm /usr/local/bin/npm install ./artisan storage:link ./artisan clear-compiled ./artisan horizon:install if [ ! -f 'resources/countries.php' ]; then ./artisan data:countries fi /usr/local/bin/npm run $RELEASE_MODE