Create docker checker and installer

pull/9/head
mate-dev 2023-09-02 14:56:01 +00:00 zatwierdzone przez mate-dev
rodzic e47d3560c7
commit 960d1143e1
2 zmienionych plików z 43 dodań i 0 usunięć

Wyświetl plik

@ -2,6 +2,7 @@ FROM python:3.11-slim-bookworm AS app
LABEL "website"="https://github.com/mate-dev/mmrelaynode"
RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 -s /bin/bash mesh
RUN pip install --upgrade pip -qq
RUN ln -s /home/mesh/.local/bin/meshtastic /bin/meshtastic
USER mesh
COPY --chown=mesh:mesh meshtastic-matrix-relay /home/mesh/app
WORKDIR /home/mesh/app

42
mmrelay.sh 100644
Wyświetl plik

@ -0,0 +1,42 @@
#!/bin/bash
set -e
#Check linux distro
OS=$(uname -s | tr A-Z a-z)
source /etc/os-release
case $ID in
debian|ubuntu|mint)
RUN="apt-get"
;;
fedora|rhel|centos)
RUN="yum"
;;
*)
echo -n "unsupported linux distro"
;;
esac
# Check and install docker and git
if ! docker &> /dev/null; then
echo "Docker is not installed. Installing it via the script from docker.com"
echo "================================================================"
sudo $RUN update &> /dev/null && sudo $RUN install -y curl &> /dev/null && sudo $RUN install -y git &> /dev/null
sudo groupadd docker > /dev/null 2>&1 || true
sudo usermod -aG docker $USER
curl -fsSL https://get.docker.com -o get-docker.sh
chmod +x get-docker.sh
sh -c ./get-docker.sh
rm get-docker.sh
fi
# Sprawdzamy, czy docker działa poprzez listowanie kontenerów
if ! docker ps | grep -q "CONTAINER"; then
echo "================================================================================"
echo "If you see this error, type 'newgrp docker' and check if 'docker ps' returns an error."
echo "Or log out and log in for the changes to take effect."
echo "After this re-enable the script."
exit 1
fi
# Pozostała część skryptu
echo "jedziemy"
#docker compose -f "docker-compose.yaml" up -d --build