Skip to content

Add azure-prebuild script #1351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions scripts/azure-prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

###########################################
# This script is used to prebuild the New
# Relic Python agent for Azure Web Apps.
# It is executed in the Azure Web App
# environment before the app is started.
###########################################

# Retrieve files to use in startup script:
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/newrelic_k8s_operator.py > newrelic_k8s_operator.py
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/requirements-vendor.txt > requirements-vendor.txt
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/requirements-builder.txt > requirements-builder.txt

cd /home/

pip install -r requirements-builder.txt

export NEW_RELIC_EXTENSIONS=false
export WRAPT_DISABLE_EXTENSIONS=true

pip install newrelic --target=./workspace/newrelic

mkdir -p ./workspace/vendor
pip install --target=./workspace/vendor -r requirements-vendor.txt

cp ./workspace/* /home/
cp /home/workspace/newrelic/newrelic/bootstrap/sitecustomize.py /home/sitecustomize.py

cd /home/site/wwwroot
Comment on lines +10 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Retrieve files to use in startup script:
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/newrelic_k8s_operator.py > newrelic_k8s_operator.py
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/requirements-vendor.txt > requirements-vendor.txt
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/requirements-builder.txt > requirements-builder.txt
cd /home/
pip install -r requirements-builder.txt
export NEW_RELIC_EXTENSIONS=false
export WRAPT_DISABLE_EXTENSIONS=true
pip install newrelic --target=./workspace/newrelic
mkdir -p ./workspace/vendor
pip install --target=./workspace/vendor -r requirements-vendor.txt
cp ./workspace/* /home/
cp /home/workspace/newrelic/newrelic/bootstrap/sitecustomize.py /home/sitecustomize.py
cd /home/site/wwwroot
# Retrieve files to use in startup script:
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/newrelic_k8s_operator.py > newrelic_k8s_operator.py
curl -L https://raw.githubusercontent.com/newrelic/newrelic-agent-init-container/refs/heads/main/src/python/requirements-vendor.txt > requirements-vendor.txt
mkdir -p /home/.newrelic
cd /home/.newrelic
pip install 'setuptools>=40.8.0' wheel
export NEW_RELIC_EXTENSIONS=false
export WRAPT_DISABLE_EXTENSIONS=true
pip install newrelic --target=./newrelic
mkdir -p ./vendor
pip install --target=./vendor -r requirements-vendor.txt
cp /home/.newrelic/newrelic/bootstrap/sitecustomize.py /home/.newrelic/sitecustomize.py
cd /home/site/wwwroot

Loading