mirror of
https://github.com/gilbN/theme.park.git
synced 2024-10-03 22:17:08 +02:00
Adds mod for SWAG
This commit is contained in:
parent
a70c2b5724
commit
2268a6ecb1
6
docker-mods/swag/Dockerfile
Normal file
6
docker-mods/swag/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM scratch
|
||||
|
||||
LABEL maintainer="GilbN"
|
||||
LABEL app="theme-park.dev"
|
||||
#copy local files.
|
||||
COPY root/ /
|
68
docker-mods/swag/root/etc/cont-init.d/98-themepark
Normal file
68
docker-mods/swag/root/etc/cont-init.d/98-themepark
Normal file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
echo '-------------------------'
|
||||
echo '| SWAG theme.park Mod |'
|
||||
echo '-------------------------'
|
||||
|
||||
if ! [[ -x "$(command -v svn)" ]]; then
|
||||
echo '--------------------------'
|
||||
echo '| Installing svn package |'
|
||||
echo '--------------------------'
|
||||
if [ -x "$(command -v apk)" ]; then
|
||||
apk update && \
|
||||
apk add --no-cache subversion
|
||||
elif [ -x "$(command -v apt-get)" ]; then
|
||||
apt-get update && \
|
||||
apt-get install -y subversion
|
||||
fi
|
||||
fi
|
||||
|
||||
# Display variables for troubleshooting
|
||||
echo -e "Variables set:\\n\
|
||||
'TP_BRANCH'=${TP_BRANCH}\\n"
|
||||
|
||||
# Set default
|
||||
if [[ -z ${TP_BRANCH} ]]; then
|
||||
echo 'No branch set, defaulting to live'
|
||||
TP_BRANCH='live'
|
||||
fi
|
||||
|
||||
if [[ ${TP_BRANCH} == "master" ]]; then
|
||||
TP_BRANCH='live'
|
||||
fi
|
||||
|
||||
if [[ ${TP_BRANCH} == "develop" ]]; then
|
||||
TP_BRANCH='live_develop'
|
||||
fi
|
||||
|
||||
if [[ ${TP_BRANCH} == "testing" ]]; then
|
||||
TP_BRANCH='live_testing'
|
||||
fi
|
||||
|
||||
mkdir -p /config/www/themepark
|
||||
|
||||
SHA_RELEASE=$(curl -sL "https://api.github.com/repos/gilbn/theme.park/commits/${TP_BRANCH}" | jq -r '.sha');
|
||||
if [[ ! -f "/config/www/themepark/sha.txt" ]]; then
|
||||
SHA=""
|
||||
else
|
||||
SHA=$(cat /config/www/themepark/sha.txt)
|
||||
fi
|
||||
# Downloading fresh webui files from source.
|
||||
if [[ $SHA != $SHA_RELEASE ]]; then
|
||||
echo "-----------------------------------------------------"
|
||||
echo "| Downloading latest files from ${TP_BRANCH} branch |"
|
||||
echo "-----------------------------------------------------"
|
||||
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/css" /config/www/themepark/css
|
||||
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/resources" /config/www/themepark/resources
|
||||
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/themes.json" /config/www/themepark
|
||||
svn export --quiet --force "https://github.com/GilbN/theme.park/branches/${TP_BRANCH}/index.html" /config/www/themepark
|
||||
printf '\nDownload finished\n\n'
|
||||
fi
|
||||
|
||||
cat <<< "$SHA_RELEASE" > "/config/www/themepark/sha.txt"
|
||||
cp /root/themepark.subdomain.conf /config/nginx/proxy-confs/themepark.subdomain.conf
|
||||
cp /root/themepark.subfolder.conf /config/nginx/proxy-confs/themepark.subfolder.conf
|
||||
|
||||
# permissions
|
||||
chown -R abc:abc \
|
||||
/config/www/themepark
|
30
docker-mods/swag/root/themepark.subdomain.conf
Normal file
30
docker-mods/swag/root/themepark.subdomain.conf
Normal file
@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
|
||||
server_name themepark.*;
|
||||
|
||||
include /config/nginx/ssl.conf;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
location / {
|
||||
alias /config/www/themepark/;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
location /themepark {return 302 $scheme://$http_host/themepark/;}
|
||||
location /themepark/ {
|
||||
alias /config/www/themepark/;
|
||||
sub_filter_types *;
|
||||
sub_filter 'url("/css/' 'url("/themepark/css/';
|
||||
sub_filter_once off;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Don't cache
|
||||
add_header Last-Modified $date_gmt;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
if_modified_since off;
|
||||
expires -1;
|
||||
etag off;
|
||||
}
|
17
docker-mods/swag/root/themepark.subfolder.conf
Normal file
17
docker-mods/swag/root/themepark.subfolder.conf
Normal file
@ -0,0 +1,17 @@
|
||||
location /themepark {
|
||||
return 302 $scheme://$http_host/themepark/;
|
||||
}
|
||||
|
||||
location /themepark/ {
|
||||
alias /config/www/themepark/;
|
||||
sub_filter_types *;
|
||||
sub_filter 'url("/css/' 'url("/themepark/css/';
|
||||
sub_filter_once off;
|
||||
try_files $uri $uri/ /index.html;
|
||||
# Don't cache
|
||||
add_header Last-Modified $date_gmt;
|
||||
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||
if_modified_since off;
|
||||
expires -1;
|
||||
etag off;
|
||||
}
|
Loading…
Reference in New Issue
Block a user