Update
This commit is contained in:
@ -14,48 +14,48 @@ echo "Using image: ${FULL_IMAGE}"
|
||||
|
||||
# Check if image exists
|
||||
if ! docker image inspect "${FULL_IMAGE}" >/dev/null 2>&1; then
|
||||
echo "Error: Docker image '${FULL_IMAGE}' not found"
|
||||
echo "Build it first with: ./build-docker-image.sh"
|
||||
exit 1
|
||||
echo "Error: Docker image '${FULL_IMAGE}' not found"
|
||||
echo "Build it first with: ./build-docker-image.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Stop and remove existing container if it exists
|
||||
if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
|
||||
echo "Stopping and removing existing container: ${CONTAINER_NAME}"
|
||||
docker stop "${CONTAINER_NAME}" >/dev/null 2>&1 || true
|
||||
docker rm "${CONTAINER_NAME}" >/dev/null 2>&1 || true
|
||||
echo "Stopping and removing existing container: ${CONTAINER_NAME}"
|
||||
docker stop "${CONTAINER_NAME}" >/dev/null 2>&1 || true
|
||||
docker rm "${CONTAINER_NAME}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Create required directories if they don't exist
|
||||
mkdir -p "$(pwd)/public/podcast_audio" "$(pwd)/data"
|
||||
mkdir -p "$(pwd)/public/podcast_audio" "$(pwd)/data" | true
|
||||
|
||||
# Check for required files
|
||||
if [[ ! -f "$(pwd)/.env" ]]; then
|
||||
echo "Warning: .env file not found. Create one with required environment variables."
|
||||
echo "Warning: .env file not found. Create one with required environment variables."
|
||||
fi
|
||||
|
||||
if [[ ! -f "$(pwd)/feed_urls.txt" ]]; then
|
||||
echo "Warning: feed_urls.txt not found. Creating empty file."
|
||||
touch "$(pwd)/feed_urls.txt"
|
||||
echo "Warning: feed_urls.txt not found. Creating empty file."
|
||||
touch "$(pwd)/feed_urls.txt"
|
||||
fi
|
||||
|
||||
# Run container with proper volume mounts and networking
|
||||
docker run \
|
||||
--detach \
|
||||
--name "${CONTAINER_NAME}" \
|
||||
--restart unless-stopped \
|
||||
--publish 3000:3000 \
|
||||
--publish 3001:3001 \
|
||||
--volume "$(pwd)/feed_urls.txt:/app/feed_urls.txt:ro" \
|
||||
--volume "$(pwd)/.env:/app/.env:ro" \
|
||||
--volume "$(pwd)/public:/app/public" \
|
||||
--volume "$(pwd)/data:/app/data" \
|
||||
--health-cmd="bun -e 'fetch(\"http://localhost:3000\").then(() => process.exit(0)).catch(() => process.exit(1))'" \
|
||||
--health-interval=30s \
|
||||
--health-timeout=3s \
|
||||
--health-start-period=10s \
|
||||
--health-retries=3 \
|
||||
"${FULL_IMAGE}"
|
||||
--detach \
|
||||
--name "${CONTAINER_NAME}" \
|
||||
--restart unless-stopped \
|
||||
--publish 3000:3000 \
|
||||
--publish 3001:3001 \
|
||||
--volume "$(pwd)/feed_urls.txt:/app/feed_urls.txt:ro" \
|
||||
--volume "$(pwd)/.env:/app/.env:ro" \
|
||||
--volume "$(pwd)/public:/app/public" \
|
||||
--volume "$(pwd)/data:/app/data" \
|
||||
--health-cmd="bun -e 'fetch(\"http://localhost:3000\").then(() => process.exit(0)).catch(() => process.exit(1))'" \
|
||||
--health-interval=30s \
|
||||
--health-timeout=3s \
|
||||
--health-start-period=10s \
|
||||
--health-retries=3 \
|
||||
"${FULL_IMAGE}"
|
||||
|
||||
echo "\nContainer started successfully!"
|
||||
echo "Container name: ${CONTAINER_NAME}"
|
||||
|
Reference in New Issue
Block a user