-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to zip python dependencies
- Loading branch information
1 parent
dde993b
commit c6f1dd4
Showing
2 changed files
with
26 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
#!/bin/bash | ||
|
||
# Pull the Amazon Linux image from Docker Hub | ||
docker pull amazonlinux | ||
|
||
# Run the Amazon Linux container in detached mode | ||
docker run -d --name telemetry amazonlinux tail -f /dev/null | ||
|
||
# Install Python, pip, and other dependencies inside the container | ||
docker exec -it telemetry /bin/bash -c "yum update -y && yum install -y python3-pip zip && python3 -m pip install virtualenv" | ||
|
||
# Create a virtual environment and install dependencies | ||
docker exec -it telemetry /bin/bash -c "python3 -m venv temp-venv && source temp-venv/bin/activate && mkdir telemetry && cd telemetry && pip install crhelper sumologic-appclient-sdk future_fstrings setuptools -t ." | ||
|
||
# Copy python file from host to container | ||
docker cp ./lambda_function.py telemetry:/telemetry | ||
|
||
# Zip the contents of the telemetry directory | ||
docker exec -it telemetry /bin/bash -c "cd telemetry && ls -l && zip -r ../telemetry.zip ." | ||
|
||
# Copy the telemetry.zip file from the container to the host | ||
docker cp telemetry:/telemetry.zip ./telemetry.zip | ||
|
||
# Stop and remove the container | ||
docker stop telemetry | ||
docker rm telemetry |