Moved scripts

This commit is contained in:
2026-04-12 02:35:05 -05:00
parent c9e77915b0
commit f4653456f3
5 changed files with 3 additions and 3 deletions

41
deploy/deploy.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -euo pipefail
APP_NAME=""
TAG=""
PORT=""
INTERNAL_PORT="3000"
ENV=""
while [[ $# -gt 0 ]]; do
case $1 in
--name) APP_NAME="$2"; shift 2 ;;
--tag) TAG="$2"; shift 2 ;;
--port) PORT="$2"; shift 2 ;;
--internal-port) INTERNAL_PORT="$2"; shift 2 ;;
--env) ENV="$2"; shift 2 ;;
*) echo "Unknown arg: $1"; exit 1 ;;
esac
done
CONTAINER="${APP_NAME}-${TAG}"
echo "→ Deploying container: ${CONTAINER} on port ${PORT}"
docker stop "${CONTAINER}" 2>/dev/null && docker rm "${CONTAINER}" 2>/dev/null || true
ENV_FILE_ARG=""
if [[ -f "/opt/apps/${APP_NAME}/.env.${ENV}" ]]; then
ENV_FILE_ARG="--env-file /opt/apps/${APP_NAME}/.env.${ENV}"
fi
docker run -d \
--name "${CONTAINER}" \
--restart unless-stopped \
-p "0.0.0.0:${PORT}:${INTERNAL_PORT}" \
-e NODE_ENV=production \
-e PORT="${INTERNAL_PORT}" \
${ENV_FILE_ARG} \
"${APP_NAME}:${TAG}"
echo "✓ Container ${CONTAINER} running on 0.0.0.0:${PORT}"