You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
docker-static-websites/root/entrypoint.sh

31 lines
897 B

#!/bin/sh
# Exit at first error
set -e
# Check if nginx configuration file exists
if [ ! -e /config/nginx.conf ]; then
echo "Configuration file nginx.conf not found. Initializing...";
cp /defaults/nginx.conf /config/nginx.conf;
fi
# Check if nginx configuration file exists
if [ ! -e /config/mime.types ]; then
echo "Configuration file mime.types not found. Initializing...";
cp /etc/nginx/mime.types /config/mime.types;
fi
# Check if conf.d directory exists
if [ ! -d /config/conf.d ]; then
echo "Directory /config/conf.d not found. Creating it...";
mkdir /config/conf.d
fi
# Check if conf.d directory has websites configuration files
if [ -z "$(ls -A /config/conf.d)" ]; then
echo "Directory /config/conf.d directory empty. Copying default.conf...";
cp /etc/nginx/conf.d/default.conf /config/conf.d/default.conf;
fi
# Launch nginx
nginx -c /config/nginx.conf