Skip to content

Commit

Permalink
Merge pull request #141 from FloRul/rich_pdf_ingestion_lambda
Browse files Browse the repository at this point in the history
try to publish lambda as docker
  • Loading branch information
joelbalcaen authored Apr 4, 2024
2 parents 3bc8c93 + fd4a9a2 commit b32f403
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Deploy Lambdas & Terraform Plan on PR

env:
RICH_PDF_INGESTION: rich_pdf_ingestion

on:
push:
branches:
Expand Down Expand Up @@ -33,6 +36,7 @@ jobs:
aws ecr describe-repositories --repository-names ${{ vars.RESUME_REQUEST_PROCESSOR_ECR_NAME }} || aws ecr create-repository --repository-name ${{ vars.RESUME_REQUEST_PROCESSOR_ECR_NAME }}
aws ecr describe-repositories --repository-names ${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }} || aws ecr create-repository --repository-name ${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }}
aws ecr describe-repositories --repository-names ${{ vars.RESUME_ECR_NAME }} || aws ecr create-repository --repository-name ${{ vars.RESUME_ECR_NAME }}
aws ecr describe-repositories --repository-names $RICH_PDF_INGESTION || aws ecr create-repository --repository-name $RICH_PDF_INGESTION
- name: Generate timestamp
id: timestamp
Expand Down Expand Up @@ -60,6 +64,8 @@ jobs:
docker push $ECR_REGISTRY/${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }}:$IMAGE_TAG
docker build -t $ECR_REGISTRY/${{ vars.RESUME_ECR_NAME }}:$IMAGE_TAG ./lambdas/ResumeProcessor/ResumeFunction
docker push $ECR_REGISTRY/${{ vars.RESUME_ECR_NAME }}:$IMAGE_TAG
docker build -t $ECR_REGISTRY/$RICH_PDF_INGESTION:$IMAGE_TAG ./lambdas/$RICH_PDF_INGESTION/src
docker push $ECR_REGISTRY/$RICH_PDF_INGESTION:$IMAGE_TAG
deploy-infra:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -120,4 +126,6 @@ jobs:
-var="resume_request_processor_lambda_repository_name=${{ vars.RESUME_REQUEST_PROCESSOR_ECR_NAME }}" \
-var="resume_request_preprocessor_lambda_repository_name=${{ vars.RESUME_REQUEST_PREPROCESSOR_ECR_NAME }}" \
-var="resume_lambda_repository_name=${{ vars.RESUME_ECR_NAME }}" \
-var="resume_lambda_repository_name=$RICH_PDF_INGESTION \
-auto-approve -no-color -input=false
8 changes: 4 additions & 4 deletions lambdas/rich_pdf_ingestion/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ locals {
lambda_function_name = "rich_pdf_ingestion"
ses_arn = "arn:aws:ses:${var.aws_region}:${data.aws_caller_identity.current.account_id}"
timeout = 30
runtime = "python3.11"
powertools_layer_arn = "arn:aws:lambda:${var.aws_region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:67"
}

Expand All @@ -12,17 +11,18 @@ data "aws_caller_identity" "current" {}
module "lambda_function_container_image" {
source = "terraform-aws-modules/lambda/aws"
function_name = local.lambda_function_name
handler = "index.lambda_handler"
publish = true
runtime = local.runtime
timeout = local.timeout
layers = [local.powertools_layer_arn]
source_path = "${path.module}/src"
s3_bucket = var.lambda_storage_bucket
memory_size = 256
role_name = "${local.lambda_function_name}-role"
attach_policy_statements = true

create_package = false
image_uri = data.aws_ecr_image.lambda_image.image_uri
package_type = "Image"

policy_statements = {
log_group = {
effect = "Allow"
Expand Down

0 comments on commit b32f403

Please sign in to comment.