Skip to content

Commit

Permalink
Merge pull request #7 from MITLibraries/stage-makefile-workflow
Browse files Browse the repository at this point in the history
Add stage commands to workflow and makefile
  • Loading branch information
zotoMIT committed Jun 7, 2022
2 parents 668a1c1 + c5c3a84 commit 327f83d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### This is the Terraform-generated stage-build.yml workflow for the alma-webhook-lambdas-stage repository ###
name: Stage Build and Deploy Lambda Container
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '.github/**'

jobs:
deploy:
name: Stage Deploy Lambda Container
uses: mitlibraries/.github/.github/workflows/lambda-shared-deploy-stage.yml@container-flows
secrets: inherit
with:
AWS_REGION: "us-east-1"
GHA_ROLE: "alma-webhook-lambdas-gha-stage"
ECR: "alma-webhook-lambdas-stage"
FUNCTION: "alma-webhook-lambdas-stage"
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ ECR_NAME_DEV:=alma-webhook-lambdas-dev
ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/alma-webhook-lambdas-dev
FUNCTION_DEV:=alma-webhook-lambdas-dev
### End of Terraform-generated header ###
### This is the Terraform-generated Makefile header for alma-webhook-lambdas-stage
ECR_NAME_STAGE:=alma-webhook-lambdas-stage
ECR_URL_STAGE:=840055183494.dkr.ecr.us-east-1.amazonaws.com/alma-webhook-lambdas-stage
FUNCTION_STAGE:=alma-webhook-lambdas-stage
### End of Terraform-generated header ###

help: ## Print this message
@awk 'BEGIN { FS = ":.*##"; print "Usage: make <target>\n\nTargets:" } \
Expand Down Expand Up @@ -63,3 +68,19 @@ update-lambda-dev: ## Updates the lambda with whatever is the most recent image
--function-name $(FUNCTION_DEV) \
--image-uri $(ECR_URL_DEV):latest

## Terraform-generated Makefile developer Deploy Commands ###
dist-stage: ## Build docker container (intended for developer-based manual build)
docker build --platform linux/amd64 \
-t $(ECR_URL_STAGE):latest \
-t $(ECR_URL_STAGE):`git describe --always` \
-t $(ECR_NAME_STAGE):latest .

publish-stage: dist-stage ## Build, tag and push (intended for developer-based manual publish)
docker login -u AWS -p $$(aws ecr get-login-password --region us-east-1) $(ECR_URL_STAGE)
docker push $(ECR_URL_STAGE):latest
docker push $(ECR_URL_STAGE):`git describe --always`

update-lambda-stage: ## Updates the lambda with whatever is the most recent image in the ecr (intended for developer-based manual update)
aws lambda update-function-code \
--function-name $(FUNCTION_STAGE) \
--image-uri $(ECR_URL_STAGE):latest

0 comments on commit 327f83d

Please sign in to comment.