This commit is contained in:
Your Name
2025-05-03 19:36:33 +12:00
parent 5909c90941
commit 2fbe5307da
5 changed files with 27 additions and 21 deletions

View File

@ -6,32 +6,20 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "VOLUME_NAME" "WRITE_TOKENS"
check_required_env_vars "CONTAINER_NAME" "HOST_PORT" "VOLUME_NAME" "WRITE_TOKENS" "CONFIG_PATH"
# check volume exists.
if ! docker volume inspect "${VOLUME_NAME}" &>/dev/null; then
die "Docker volume ${VOLUME_NAME} does not exist"
fi
# heredoc for config file. Have to use double quotes to substitute variables.
docker run --rm -v ${VOLUME_NAME}:/data debian bash -c "\
cat <<EOF > /data/sos_config.json
{
\"write_tokens\": [
${WRITE_TOKENS}
],
\"object_store_path\": \"/data/storage\",
\"host\": \"0.0.0.0\",
\"port\": ${HOST_PORT}
}
EOF
"
DOCKER_RUN_CMD="docker run -d \
--restart unless-stopped \
--name ${CONTAINER_NAME} \
-p ${HOST_PORT}:80 \
-v ${VOLUME_NAME}:/data \
-v ${VOLUME_NAME}:/data/storage \
-v ${CONFIG_PATH}/sos_config.json:/data/sos_config.json:ro \
${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"