#!/bin/bash # Configuration IMAGE_NAME="markdown-blog" CONTAINER_NAME="markdown-blog-container" PORT=3000 MARKDOWN_DIR="/path/to/your/markdown" # Update this to your local markdown directory # Function to build the Docker image build_image() { echo "Building Docker image..." docker build -t $IMAGE_NAME . } # Function to start the container start_container() { echo "Starting container..." docker run -d --name $CONTAINER_NAME -p $PORT:3000 -v $MARKDOWN_DIR:/markdown $IMAGE_NAME } # Function to stop the container stop_container() { echo "Stopping container..." docker stop $CONTAINER_NAME } # Function to restart the container restart_container() { echo "Restarting container..." docker restart $CONTAINER_NAME } # Function to view logs view_logs() { echo "Viewing logs..." docker logs $CONTAINER_NAME } # Main script logic case "$1" in build) build_image ;; start) start_container ;; stop) stop_container ;; restart) restart_container ;; logs) view_logs ;; *) echo "Usage: $0 {build|start|stop|restart|logs}" exit 1 ;; esac exit 0