Migrate if installed commit differs from program commit

This commit is contained in:
Quentin McGaw (desktop) 2021-08-03 09:31:59 -04:00
parent f0eb18653e
commit 482e97e2c1
2 changed files with 9 additions and 3 deletions

View File

@ -168,6 +168,7 @@ ENV \
ARG VERSION=unknown
ARG CREATED="an unknown date"
ARG COMMIT=unknown
ENV COMMIT=${COMMIT}
LABEL \
org.opencontainers.image.authors="https://github.com/Bubka" \
org.opencontainers.image.version=$VERSION \

View File

@ -23,15 +23,20 @@ else
fi
ln -sF /2fauth/storage /srv/storage
# Note: ${COMMIT} is set by the CI
if [ -f /2fauth/installed ]; then
php artisan migrate
php artisan config:clear
INSTALLED_COMMIT="$(cat /2fauth/installed)"
if [ "${INSTALLED_COMMIT}" != "${COMMIT}" ]; then
echo "Installed commit ${INSTALLED_COMMIT} is different from program commit ${COMMIT}, we are migrating..."
php artisan migrate
php artisan config:clear
fi
else
php artisan migrate:refresh
php artisan passport:install
echo "do not remove me" > /2fauth/installed
fi
echo "${COMMIT}" > /2fauth/installed
php artisan storage:link
php artisan config:cache