dev: public ready
dev: Readme, COC, others dev: xml-template
This commit is contained in:
parent
5db584830b
commit
1cf5119f46
12 changed files with 3716 additions and 0 deletions
35
bash-scripts/run.sh
Executable file
35
bash-scripts/run.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
IMAGE_NAME="localhost/gopherbook:latest"
|
||||
CONTAINER_NAME="gopherbook"
|
||||
|
||||
echo "Building new image: $IMAGE_NAME..."
|
||||
podman build --force-rm -t "$IMAGE_NAME" .
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Image build failed. Exiting script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure directories exist with correct permissions
|
||||
mkdir -p ./library ./cache ./etc
|
||||
|
||||
if podman container exists "$CONTAINER_NAME"; then
|
||||
echo "Container '$CONTAINER_NAME' already exists. Stopping and removing it..."
|
||||
podman stop "$CONTAINER_NAME"
|
||||
podman rm "$CONTAINER_NAME"
|
||||
fi
|
||||
|
||||
echo "Starting new container from image: $IMAGE_NAME..."
|
||||
podman run -d --name "$CONTAINER_NAME" --memory=256m --restart unless-stopped \
|
||||
-p 12010:8080 -v ./library:/app/library -v ./cache:/app/cache -v ./etc:/app/etc "$IMAGE_NAME"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to start new container. Exiting script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cleaning up old images..."
|
||||
podman image prune --force
|
||||
|
||||
echo "Update and cleanup complete!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue