ComposePress/generate-compose-nginx.sh

19 lines
763 B
Bash
Executable File

#!/bin/bash
# Docker service names are designed to be static, not dynamic,
# primarily due to the need for predictable and consistent communication
# between services within a Docker Compose environment. However, since an
# external letsencrypt network is utilized, conflicts occur if the service
# name is not unique to the project. This script resolves that issue by
# generating a docker-compose.yml file with unique service names, which is
# the COMPOSE_PROJECT_NAME
# Load variables from .env file
if [ -f .env ]; then
source .env
fi
export SERVICE_SUFFIX=${COMPOSE_PROJECT_NAME:-main}
export COMPOSE_PROJECT_NAME
envsubst < docker-compose.template.yml > docker-compose.yml
envsubst '${COMPOSE_PROJECT_NAME}' < default.template.conf > default.conf