-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathlaunch-docker.sh
38 lines (28 loc) · 976 Bytes
/
launch-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Set the container name
CONTAINER_NAME="queue-bot"
# Check if the container is running
if [ "$(docker ps -q -f name=${CONTAINER_NAME})" ]; then
# Create a dated log file name
LOG_FILE="logs/${CONTAINER_NAME}_$(date +'%Y-%m-%d_%H-%M-%S').log"
# Save the logs to the file
mkdir -p logs
docker logs -t $CONTAINER_NAME >& $LOG_FILE
# Check if the logs were saved successfully
if [ $? -eq 0 ]; then
echo "Logs saved to $LOG_FILE"
else
echo "Failed to save logs"
exit 1
fi
else
echo "Container ${CONTAINER_NAME} is not running. Skipping log saving."
fi
# Fetch the latest changes from the remote repository
git fetch
# Merge the fetched changes with a custom commit message
git merge --no-ff -m "Merged changes from remote repository."
docker compose down
docker compose up -d --build
docker image prune -f
echo "Attaching to container ${CONTAINER_NAME}... (CTRL+p CTRL+q to detach)"
docker attach queue-bot