Skip to content

Commit

Permalink
feat(#71): Use lambda layers to delete api/package directory
Browse files Browse the repository at this point in the history
Closes #71
  • Loading branch information
Joalia authored Jan 31, 2024
1 parent 4a29b4b commit 68655fd
Show file tree
Hide file tree
Showing 592 changed files with 182 additions and 156,729 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/deploy_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
env:
# All TF variables are define din Terraform Cloud
API_KEY_TEST_MAIL: ${{secrets.API_KEY_TEST_MAIL}}
TEST_MAIL_NAMESPACE: ${{secrets.TEST_MAIL_NAMESPACE}}
TEST_MAIL_NAMESPACE: ${{secrets.TEST_MAIL_NAMESPACE}}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
steps:
Expand Down Expand Up @@ -96,6 +96,14 @@ jobs:
curl -O -L https://github.com/env0/terratag/releases/download/v0.1.48/terratag_0.1.48_linux_amd64.tar.gz
tar -xvf terratag_0.1.48_linux_amd64.tar.gz
./terratag -tags="project=mtchoun-mouh,environment=$GITHUB_REF_NAME" -dir=infra/ -rename=false
- name: Build python lambda layer
id: plan
run: |
cd make_lamnda_layer
chmod +x runner.sh
./runner.sh
- name: Terraform Plan
id: plan
run: |
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ repos:
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.17
hooks:
- id: shellcheck
#- id: shellcheck
- id: terraform-fmt
- id: terraform-validate
- id: tflint
# - id: tflint
- repo: https://github.com/ambv/black
rev: 22.6.0
hooks:
- id: black
lambda-layer
language_version: python3
- repo: https://github.com/Yelp/detect-secrets
rev: v1.3.0
Expand Down
10 changes: 10 additions & 0 deletions infra/api/make_lamda_layer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM amazonlinux:2018.03
RUN ulimit -n 1024 && yum -y update && yum -y install \
python38 \
python38-pip \
python38-devel \
zip \
&& yum clean all

RUN python3 -m pip install pip==22.1.2
RUN pip install virtualenv==20.14.1
6 changes: 6 additions & 0 deletions infra/api/make_lamda_layer/docker_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
virtualenv --python=/usr/bin/python3.8 python #Python is the name of de layer
soure python/bin/active
pip install -r requirements.txt -t python/lib/python3.8/site-pakages

zip -r9 python.zip python
9 changes: 9 additions & 0 deletions infra/api/make_lamda_layer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
beautifulsoup4==4.9.1
certifi==2022.12.7
chardet==3.0.4
idna==2.10
requests==2.31.0
soupsieve==2.0.1
zulip==0.8.2
sentry-sdk==1.14.0
python-lambda==11.8.0
14 changes: 14 additions & 0 deletions infra/api/make_lamda_layer/runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

container_name=lambda_docker
docker_image=aws_lambda_builder_image

docker build --tag $container_name .

docker run -td --name=$container_name $docker_image
docker cp ./requirements.txt $container_name:/

docker exec -i $container_name /bin/bash < ./docker_install.sh
docker cp $container_name:/python.zip python.zip
docker stop $container_name
docker rm $container_name
49 changes: 0 additions & 49 deletions infra/api/package/beautifulsoup4-4.9.1.dist-info/AUTHORS

This file was deleted.

27 changes: 0 additions & 27 deletions infra/api/package/beautifulsoup4-4.9.1.dist-info/COPYING.txt

This file was deleted.

1 change: 0 additions & 1 deletion infra/api/package/beautifulsoup4-4.9.1.dist-info/INSTALLER

This file was deleted.

30 changes: 0 additions & 30 deletions infra/api/package/beautifulsoup4-4.9.1.dist-info/LICENSE

This file was deleted.

131 changes: 0 additions & 131 deletions infra/api/package/beautifulsoup4-4.9.1.dist-info/METADATA

This file was deleted.

45 changes: 0 additions & 45 deletions infra/api/package/beautifulsoup4-4.9.1.dist-info/RECORD

This file was deleted.

Empty file.
5 changes: 0 additions & 5 deletions infra/api/package/beautifulsoup4-4.9.1.dist-info/WHEEL

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions infra/api/package/bin/chardetect

This file was deleted.

Loading

0 comments on commit 68655fd

Please sign in to comment.