Compare commits

...
5 Commits
4 changed files with 15 additions and 12 deletions

No files matched your search

@@ -6,11 +6,11 @@ services:
container_name: hugo
build:
context: ./
image: hyperling-hugo:latest
image: hyperling-hugo:$BRANCH
restart: always
ports:
- 8013:80 # Production minified files served using NGINX.
- 1380:1380 # Development files with drafts served by Hugo Server.
- $PROD_PORT:80 # Production minified files served using NGINX.
#- $DEV_PORT:1380 # Development files with drafts served by Hugo Server.
environment:
- REPO=$REPO
- BRANCH=$BRANCH
+2
View File
@@ -17,9 +17,11 @@ BRANCH=prod
# Whether to start NGINX
PROD=YES
PROD_PORT=8013
# Whether to start Hugo Server
DEV=NO
DEV_PORT=1380
#
## Resources ##
+1 -1
View File
@@ -30,7 +30,7 @@ fi
## Variables ##
dir="$1"
file="$dir/docker-compose.yml"
file="$dir/compose.yml"
## Main ##
+9 -8
View File
@@ -151,13 +151,14 @@ if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
pwd
# Ensure env file exists so that all compose variables are populated.
if [[ -e "./example.env" && ! -e "./.env" && -f "docker-compose.yml" ]]; then
if [[ -f "./example.env" && ! -f "./.env" \
&& ( -f "docker-compose.yml" || -f "compose.yml") ]]; then
echo "WARNING: .env file was not found, copying example as placeholder."
cp -v example.env .env
fi
# Ensure all configuration files have been created.
if [[ -d "./config" && -f "docker-compose.yml" ]]; then
if [[ -d "./config" && (-f "docker-compose.yml" || -f "compose.yml") ]]; then
ls ./config/*.example 2>/dev/null | while read example; do
real=${example//.example/}
if [[ ! -e $real ]]; then
@@ -168,12 +169,12 @@ if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
fi
# Run the prep script to create any necessary volumes.
if [[ -f "prep.sh" && -f "docker-compose.yml" ]]; then
if [[ -f "prep.sh" && (-f "docker-compose.yml" || -f "compose.yml") ]]; then
./prep.sh
fi
# Run any maintenance scripts associated with the container.
if [[ "$maintenance" == "Y" && -f "docker-compose.yml" ]]; then
if [[ "$maintenance" == "Y" && (-f "docker-compose.yml" || -f "compose.yml") ]]; then
if [[ -f "maintenance.sh" ]]; then
./maintenance.sh
fi
@@ -184,22 +185,22 @@ if [[ -n $up || -n $down || -n $build || -n $pull || -n $maintenance ]]; then
# Update container from remote source such as Docker Hub.
if [[ $pull == "Y" ]]; then
[ -e docker-compose.yml ] && docker compose pull
[[ -f "docker-compose.yml" || -f "compose.yml" ]] && docker compose pull
fi
# Execute commands within the container's Dockerfile.
if [[ $build == "Y" ]]; then
[ -e Dockerfile ] && docker compose build
[[ -e Dockerfile ]] && docker compose build
fi
# Shut off container.
if [[ $down == "Y" ]]; then
[ -e docker-compose.yml ] && docker compose down
[[ -f "docker-compose.yml" || -f "compose.yml" ]] && docker compose down
fi
# Run the container as a daemon.
if [[ $up == "Y" ]]; then
[ -e docker-compose.yml ] && docker compose up -d
[[ -f "docker-compose.yml" || -f "compose.yml" ]] && docker compose up -d
fi
cd ..