make script support docker

This commit is contained in:
Simon Larsen 2023-04-18 14:20:14 +01:00
parent 396e44cb75
commit 696e3c71c2
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
3 changed files with 23 additions and 7 deletions

View File

@ -9,6 +9,8 @@ WORKDIR /usr/src/app
COPY . /usr/src/app/
ENV IS_DOCKER=true
RUN bash install.sh
# Expose ports.

View File

@ -1,7 +1,14 @@
#!/usr/bin/env bash
# If its not environment IS_DOCKER then exit
if[[ $IS_DOCKER == "true" ]]; then
echo "This script should run in the docker container."
else
# Pull latest changes
git pull
fi
set -e

View File

@ -61,6 +61,10 @@ if [[ ! $(which git) ]]; then
fi
fi
if[[ $IS_DOCKER == "true" ]]; then
echo "This script should run in the docker container."
else
GIT_REPO_URL=$(git config --get remote.origin.url)
if [[ $GIT_REPO_URL != *oneuptime* ]] # * is used for pattern matching
@ -68,6 +72,9 @@ then
git clone https://github.com/OneUptime/oneuptime.git || true
cd oneuptime
fi
fi
# if this script is not running in CI/CD
if [ -z "$CI_PIPELINE_ID" ]