File tree Expand file tree Collapse file tree 5 files changed +74
-7
lines changed
Expand file tree Collapse file tree 5 files changed +74
-7
lines changed Original file line number Diff line number Diff line change 11.vscode /
2- venv /
2+ venv /
3+ install_gitlab_ci_centos8 /
Original file line number Diff line number Diff line change 44curl -L " https://raw.githubusercontent.com/A1ex3/install_gitlab_ci_centos8/refs/tags/<TAG>/install_gitlab-runner_and_docker.sh" | sudo bash
55```
66
7+ ## Installing scripts for Docker (Optional)
8+ ``` bash
9+ curl -L " https://raw.githubusercontent.com/A1ex3/install_gitlab_ci_centos8/refs/tags/<TAG>/install_docker_scripts.sh" | sudo bash
10+ ```
11+
712## If you have problems with the package manager, use this script.
813
914``` bash
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description =Script for automatic docker management for gitlab ci
3+ After =network.target
4+
5+ [Service]
6+ ExecStart =/gitlab_ci_scripts/venv/bin/python3 /gitlab_ci_scripts/dckr/remove_unused_docker_images.py --config /gitlab_ci_scripts/config.json
7+ WorkingDirectory =/gitlab_ci_scripts
8+ User =root
9+ Restart =always
10+ RestartSec =10
11+ StandardOutput =append:/var/log/gitlab_ci_docker_scripts.log
12+ StandardError =append:/var/log/gitlab_ci_docker_scripts.log
13+
14+ [Install]
15+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ PWD=$( pwd)
4+ REPO_NAME=" install_gitlab_ci_centos8"
5+ REPO_VERSION=" main"
6+ WORK_DIR_NAME=" /gitlab_ci_scripts"
7+
8+ function check_dependency () {
9+ if ! command -v $1 & > /dev/null; then
10+ echo " '$1 ' not found!"
11+ return 1
12+ else
13+ return 0
14+ fi
15+ }
16+
17+ check_dependency git || exit 1
18+ check_dependency python3 || exit 1
19+ check_dependency pip && pip3 || exit 1
20+
21+ rm -rf $REPO_NAME
22+ if ! git clone -b " $REPO_VERSION " https://github.com/A1ex3/" $REPO_NAME .git" ; then
23+ echo " Failed to clone the repository!"
24+ exit 1
25+ fi
26+
27+ if cp " $REPO_NAME /dckr/gitlab_ci_docker_scripts.service" /etc/systemd/system/gitlab_ci_docker_scripts.service; then
28+ rm -f " $REPO_NAME /dckr/gitlab_ci_docker_scripts.service"
29+ else
30+ echo " Failed to copy service file!"
31+ exit 1
32+ fi
33+
34+ rm -rf " $WORK_DIR_NAME "
35+ mkdir -p " $WORK_DIR_NAME "
36+ cp -ru " $REPO_NAME /dckr/" * " $WORK_DIR_NAME "
37+ rm -rf " $REPO_NAME "
38+
39+ cd " $WORK_DIR_NAME " || exit 1
40+
41+ if ! pip3 install -r requirements.txt; then
42+ echo " Failed to install dependencies for Python!"
43+ exit 1
44+ fi
45+
46+ cd " $PWD " || exit 1
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33if ! command -v docker & > /dev/null; then
4- sudo yum install -y yum-utils
5- sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
6- sudo yum install docker-ce docker-ce-cli containerd.io -y
4+ yum install -y yum-utils
5+ yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
6+ yum install docker-ce docker-ce-cli containerd.io -y
77
8- sudo systemctl start docker
9- sudo systemctl enable docker
8+ systemctl start docker
9+ systemctl enable docker
1010
1111 if ! command -v docker & > /dev/null; then
1212 echo " Failed to install Docker"
1818
1919if ! command -v gitlab-runner & > /dev/null; then
2020 curl -L " https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
21- sudo yum install gitlab-runner -y
21+ yum install gitlab-runner -y
2222
2323 if ! command -v gitlab-runner & > /dev/null; then
2424 echo " Failed to install gitlab-runner"
You can’t perform that action at this time.
0 commit comments