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