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