make script support docker

This commit is contained in:
Simon Larsen
2023-04-18 14:20:14 +01:00
parent 396e44cb75
commit 696e3c71c2
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
# Pull latest changes
git pull
# 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,14 +61,21 @@ if [[ ! $(which git) ]]; then
fi
fi
GIT_REPO_URL=$(git config --get remote.origin.url)
if [[ $GIT_REPO_URL != *oneuptime* ]] # * is used for pattern matching
then
git clone https://github.com/OneUptime/oneuptime.git || true
cd oneuptime
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
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" ]
then