-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENHANCEMENT] automated way to create the binary
* automated way to create the binary * removing some comments
- Loading branch information
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM localhost/py_38 | ||
|
||
WORKDIR /app | ||
CMD git clone https://github.com/C-RH-C/crhc-cli.git && \ | ||
python3.8 -m venv ~/.venv/crhc-cli && \ | ||
source ~/.venv/crhc-cli/bin/activate && \ | ||
pip install --upgrade pip && \ | ||
cd crhc-cli && \ | ||
pip install -r requirements.txt && \ | ||
./crhc.py && \ | ||
pyinstaller --onefile crhc.py && \ | ||
cp dist/crhc /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM docker.io/dokken/centos-7 | ||
|
||
WORKDIR /app | ||
RUN yum install gcc zlib-devel openssl-devel libffi-devel git -y && \ | ||
yum clean all && \ | ||
wget https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tgz && \ | ||
tar xvf Python-3.8.18.tgz | ||
|
||
WORKDIR /app/Python-3.8.18 | ||
RUN pwd && \ | ||
./configure --enable-shared && make && make install && \ | ||
echo "/usr/local/lib/" >/etc/ld.so.conf.d/py.conf && \ | ||
ldconfig -v && \ | ||
python3.8 --version | ||
|
||
WORKDIR /app | ||
RUN rm -rf Python-3.8.18* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Generate the binary | ||
|
||
Feel free to execute this script on any rhel/linxu that you are testing crhc-cli, this will create 2 containers | ||
|
||
- The first one with the python version 3.8 | ||
- The second one which will create a binary file based on the latest version of crhc-cli code, and this will be compatible with rhel7/8 or glibc of rhel7/8 | ||
|
||
|
||
Just execute the script and it will be enough to prepare everything. Note that you will be notified about removing any image that you have, assuming this is not a big deal, the script will proceed and do all the necessary steps. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/bash | ||
|
||
cleaning_all_images() | ||
{ | ||
read -p "This operation will remove all the current container iamges. Proceed? (y/n): " answer | ||
|
||
if [ "$answer" == "y" ]; then | ||
echo "Ok, proceeding and removing all the local images" | ||
else | ||
echo "exiting ..." | ||
exit 1 | ||
fi | ||
podman rmi -a --force | ||
} | ||
|
||
check_final_dir() | ||
{ | ||
if [ -d /tmp/app ]; then | ||
echo "The directory '/tmp/app' is present, removing it" | ||
echo "running the command 'rm -rfv /tmp/app/'" | ||
rm -rfv /tmp/app/ | ||
fi | ||
|
||
mkdir -pv /tmp/app | ||
} | ||
|
||
create_py38_container() | ||
{ | ||
# Creating the container | ||
podman build . -t py_38 -f Containerfile.py_38 --layers=false --no-cache | ||
} | ||
|
||
create_crhc-cli_container() | ||
{ | ||
# Creating the container | ||
podman build . -t crhc-pkg -f Containerfile.crhc-pkg --layers=false --no-cache | ||
} | ||
|
||
create_crhc_bin() | ||
{ | ||
# Running the container and creating the binary at /tmp/app | ||
podman run --rm --name crhc-cli-build -v /tmp/app:/app:Z localhost/crhc-pkg | ||
} | ||
|
||
# Main | ||
cleaning_all_images | ||
check_final_dir | ||
create_py38_container | ||
create_crhc-cli_container | ||
create_crhc_bin |