Skip to content

Commit

Permalink
🧑‍💻 Justfile commands for build, push & update
Browse files Browse the repository at this point in the history
  • Loading branch information
aliberts committed Nov 26, 2023
1 parent 5f2c791 commit 3edb06c
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,37 @@ export-req:
poetry export -f requirements.txt --output requirements.txt --without-hashes

build:
docker build --platform linux/amd64 -t docker-image:test .
docker build --platform linux/amd64 -t inews:test .

run:
docker run \
--env AWS_ACCESS_KEY_ID \
--env AWS_SECRET_ACCESS_KEY \
--env AWS_REGION \
-i -p 9000:8080 docker-image:test
-i -p 9000:8080 inews:test

brun: export-req build run

trigger:
curl "http://192.168.63.101:9000/2015-03-31/functions/function/invocations" -d '{}'
login-ecr:
aws ecr get-login-password --region eu-west-3 | \
docker login --username AWS --password-stdin 976114805627.dkr.ecr.eu-west-3.amazonaws.com

cleanup:
rm data/html/build/*.html
rm data/newsletters/*.json
rm data/stories/*.json
rm data/summaries/*.json
rm data/transcripts/*.json
build-ecr:
docker build --platform linux/amd64 -t inews .

tag-ecr:
docker tag inews:latest 976114805627.dkr.ecr.eu-west-3.amazonaws.com/inews:latest

push-ecr:
docker push 976114805627.dkr.ecr.eu-west-3.amazonaws.com/inews:latest

update-lambda: export-req login-ecr build-ecr tag-ecr push-ecr
aws lambda update-function-code \
--function-name inews \
--image-uri 976114805627.dkr.ecr.eu-west-3.amazonaws.com/inews:latest

trigger-test:
curl "http://192.168.63.101:9000/2015-03-31/functions/function/invocations" -d '{"Status": "test"}'

trigger-prod:
curl "http://192.168.63.101:9000/2015-03-31/functions/function/invocations" -d '{"Status": "prod"}'

0 comments on commit 3edb06c

Please sign in to comment.