Commit 127744c 1 parent 4501849 commit 127744c Copy full SHA for 127744c
File tree 2 files changed +73
-0
lines changed
2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Set flag
4
+ set -e
5
+
6
+ # Ensure podman or docker is installed
7
+ if ! command -v podman & > /dev/null; then
8
+ if ! command -v docker & > /dev/null; then
9
+ echo " Neither podman nor docker is installed"
10
+ exit 1
11
+ fi
12
+ fi
13
+
14
+ # Check distro and install dependencies
15
+ if [ -f /etc/redhat-release ]; then
16
+ echo " RHEL"
17
+ sudo yum install -y ruby ruby-devel rubygems gcc
18
+ elif [ -f /etc/debian_version ]; then
19
+ echo " Debian"
20
+ sudo apt-get install -y ruby ruby-dev rubygems gcc
21
+ else
22
+ echo " Unsupported distro"
23
+ exit 1
24
+ fi
25
+
26
+ cd ..
27
+
28
+ cat << EOF > /tmp/Dockerfile
29
+ FROM ruby:2.7
30
+ WORKDIR /app
31
+ COPY . .
32
+ RUN apt-get update && apt-get install libldap-dev libsasl2-dev
33
+ RUN bundle install
34
+ RUN gem build smart_proxy_realm_ad_plugin.gemspec
35
+ EOF
36
+
37
+ # Build the image
38
+ if command -v podman & > /dev/null; then
39
+ podman build -t my-ruby-app -f /tmp/Dockerfile .
40
+ elif command -v docker & > /dev/null; then
41
+ docker build -t my-ruby-app -f /tmp/Dockerfile .
42
+ fi
43
+
44
+ docker rm -f builder|| true
45
+ docker run -d --name=builder my-ruby-app:latest sleep infinity
46
+ docker cp builder:/app/smart_proxy_realm_ad_plugin-0.1.gem .
47
+
48
+
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Check distro and install dependencies
4
+ if [ -f /etc/redhat-release ]; then
5
+ # CHeck for RHEL 9
6
+ if grep -q " Red Hat Enterprise Linux 9" /etc/redhat-release; then
7
+ echo " RHEL 9"
8
+ sudo dnf update
9
+ sudo dnf clean all
10
+ sudo dnf install -y https://yum.theforeman.org/releases/nightly/el9/x86_64/foreman-release.rpm
11
+ sudo dnf install -y https://yum.puppet.com/puppet7-release-el-9.noarch.rpm
12
+ sudo dnf repolist enabled
13
+ sudo dnf upgrade
14
+ sudo dnf install -y foreman-installer
15
+ sudo dnf -y install rubygem-radcli rubygem-smart_proxy_realm_ad_plugin
16
+ fi
17
+ # Not supported yet
18
+ echo " The script does not support this version of RHEL"
19
+ elif [ -f /etc/debian_version ]; then
20
+ echo " Debian"
21
+ echo " Not implemented"
22
+ else
23
+ echo " Unsupported distro"
24
+ exit 1
25
+ fi
You can’t perform that action at this time.
0 commit comments