Last active
December 26, 2018 22:19
-
-
Save pirogoeth/fd68b3bb56650933b5414675ac0754b1 to your computer and use it in GitHub Desktop.
slightly modified entrypoint for snipe-it's docker build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# fix key if needed | |
if [ -z "$APP_KEY" ] | |
then | |
echo "Please re-run this container with an environment variable \$APP_KEY" | |
echo "An example APP_KEY you could use is: " | |
php artisan key:generate --show | |
exit | |
fi | |
if [ -f /var/lib/snipeit/ssl/snipeit-ssl.crt -a -f /var/lib/snipeit/ssl/snipeit-ssl.key ] | |
then | |
a2enmod ssl | |
else | |
a2dismod ssl | |
fi | |
# create data directories | |
for dir in \ | |
'data/private_uploads' \ | |
'data/uploads/accessories' \ | |
'data/uploads/avatars' \ | |
'data/uploads/barcodes' \ | |
'data/uploads/categories' \ | |
'data/uploads/companies' \ | |
'data/uploads/components' \ | |
'data/uploads/consumables' \ | |
'data/uploads/departments' \ | |
'data/uploads/locations' \ | |
'data/uploads/manufacturers' \ | |
'data/uploads/models' \ | |
'data/uploads/suppliers' \ | |
'dumps' \ | |
'keys' | |
do | |
[ ! -d "/var/lib/snipeit/$dir" ] && mkdir -p "/var/lib/snipeit/$dir" | |
done | |
for dir in \ | |
'framework/sessions' \ | |
'framework/views' \ | |
'framework/cache' | |
do | |
[ ! -d "/var/www/html/storage/$dir" ] && mkdir -p "/var/www/html/storage/$dir" | |
done | |
chown -R docker:root /var/www/html/storage | |
chown -R docker:root /var/www/html/public/uploads | |
chown -R docker:root /var/lib/snipeit/data/* | |
chown -R docker:root /var/lib/snipeit/dumps | |
chown -R docker:root /var/lib/snipeit/keys | |
# If the Oauth DB files are not present copy the vendor files over to the db migrations | |
if [ ! -f "/var/www/html/database/migrations/*create_oauth*" ] | |
then | |
cp -ax /var/www/html/vendor/laravel/passport/database/migrations/* /var/www/html/database/migrations/ | |
fi | |
. /etc/apache2/envvars | |
exec apache2 -DNO_DETACH < /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment