Added docker build scripts
This commit is contained in:
parent
3e6d3a0fb4
commit
674dbc2473
3 changed files with 185 additions and 0 deletions
5
installation_stuff/logdoctor.DOCKER
Normal file
5
installation_stuff/logdoctor.DOCKER
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
xhost +
|
||||
docker run -e DISPLAY=$DISPLAY --pid=host
|
||||
xhost -
|
83
scripts/DOCKER_build_install.sh
Normal file
83
scripts/DOCKER_build_install.sh
Normal file
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Store the actual path
|
||||
current_path=$(pwd)
|
||||
|
||||
# Get the path of LogDoctor-git's folder and move in
|
||||
docdir="$(dirname $(dirname $(realpath $0)))"
|
||||
cd "$docdir"
|
||||
|
||||
# Check the existence of a previous image
|
||||
docker images | grep LogDoctor &> /dev/null
|
||||
if [[ "$?" == "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 11)Warning:$(tput sgr0) an image already exists, please run the $(tput bold)update$(tput sgr0) script instead"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check docker availability
|
||||
which docker &> /dev/null
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) Docker is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check debian:latest image
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Checking base image$(tput sgr0)"
|
||||
|
||||
# Check the existence of debian:latest image
|
||||
docker images | grep debian | grep latest &> /dev/null
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# Image not found, pull it
|
||||
docker pull debian:latest
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to pull debian:latest"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Done checking
|
||||
wait
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) Checked succesfully"
|
||||
|
||||
# Start the build process
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Building LogDoctor image$(tput sgr0)"
|
||||
|
||||
# Build the docker image
|
||||
docker build -t LogDoctor:latest .
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to build the image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Compilation finished
|
||||
wait
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) Built succesfully"
|
||||
|
||||
# Start installing LogDoctor
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Installing$(tput sgr0)"
|
||||
cd installation_stuff
|
||||
|
||||
chmod 644 ./LogDoctor.desktop
|
||||
sudo install -DC ./LogDoctor.desktop -t /usr/share/applications
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to create a menu entry"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod 755 ./logdoctor.DOCKER
|
||||
sudo install -DC ./logdoctor.DOCKER /usr/bin/logdoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to copy the executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Installation finished
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) $(tput bold)Installed succesfully$(tput sgr0)"
|
||||
cd "$current_path"
|
97
scripts/DOCKER_build_update.sh
Normal file
97
scripts/DOCKER_build_update.sh
Normal file
|
@ -0,0 +1,97 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Store the actual path
|
||||
current_path=$(pwd)
|
||||
|
||||
# Get the path of LogDoctor-git's folder and move in
|
||||
docdir="$(dirname $(dirname $(realpath $0)))"
|
||||
cd "$docdir"
|
||||
|
||||
# Check docker availability
|
||||
which docker &> /dev/null
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) Docker is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check the existence of a previous image
|
||||
docker images | grep LogDoctor &> /dev/null
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 11)Warning:$(tput sgr0) no previous image already found, please run the $(tput bold)install$(tput sgr0) script instead"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check debian:latest image
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Checking base image$(tput sgr0)"
|
||||
|
||||
# Check the existence of debian:latest image
|
||||
docker images | grep debian | grep latest &> /dev/null
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# Image not found, pull it
|
||||
docker pull debian:latest
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to pull debian:latest"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Done checking
|
||||
wait
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) Checked succesfully"
|
||||
|
||||
# Remove the old image
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Removing old LogDoctor image$(tput sgr0)"
|
||||
|
||||
docker image rm LogDoctor:latest
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to remove LogDoctor:latest"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Done removing
|
||||
wait
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) Removed succesfully"
|
||||
|
||||
# Start the build process
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Building new LogDoctor image$(tput sgr0)"
|
||||
|
||||
# Build the docker image
|
||||
docker build -t LogDoctor:latest .
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to build the image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Compilation finished
|
||||
wait
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) Built succesfully"
|
||||
|
||||
# Start updating LogDoctor
|
||||
echo "$(tput setaf 12)==>$(tput sgr0) $(tput bold)Updating$(tput sgr0)"
|
||||
cd installation_stuff
|
||||
|
||||
chmod 644 ./LogDoctor.desktop
|
||||
sudo install -DC ./LogDoctor.desktop -t /usr/share/applications
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to create a menu entry"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod 755 ./logdoctor.DOCKER
|
||||
sudo install -DC ./logdoctor.DOCKER /usr/bin/logdoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "$(tput setaf 1)Error:$(tput sgr0) failed to copy the executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Update finished
|
||||
echo "$(tput setaf 10)-->$(tput sgr0) $(tput bold)Updated succesfully$(tput sgr0)"
|
||||
cd "$current_path"
|
Loading…
Reference in a new issue