Skip to content

Commit

Permalink
Added script to zip python dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
himsharma01 committed Jun 28, 2024
1 parent dde993b commit c6f1dd4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
19 changes: 0 additions & 19 deletions cloudformation-telemetry/deploy.sh

This file was deleted.

26 changes: 26 additions & 0 deletions cloudformation-telemetry/install_python_dependencies.sh
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

0 comments on commit c6f1dd4

Please sign in to comment.