Skip to content

Commit

Permalink
deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed May 20, 2024
1 parent 60c5615 commit fde0d47
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 21 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Deploy Docker Image to AWS Lambda

on:
push:
branches:
- master

concurrency:
group: deploy
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push Docker image
env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f docker/Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubActionsRole
aws-region: ${{ secrets.AWS_REGION }}

- name: Update Lambda function to use new Docker image
env:
FUNCTION_NAME: ${{ secrets.LAMBDA_FUNCTION_NAME }}
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: latest
run: |
aws lambda update-function-code --function-name $FUNCTION_NAME --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,3 @@ build/
dist/
*.so
out*/

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

This is the code for our online store. This is a simple store for buying and selling humanoid robots.

## Frontend
## Development

To develop just the frontend, see the [frontend README](../frontend/README.md).

## Full

To develop the full stack, start FastAPI and React in separate terminals:
To develop the application, start FastAPI and React in separate terminals:

### FastAPI

Expand Down
10 changes: 0 additions & 10 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,3 @@ fi

# Builds the API Docker image.
docker build -t kscale-store -f docker/Dockerfile .

# Log in to ECR.
# aws ecr get-login-password | docker login --username AWS --password-stdin ${WIKIBOT_ECR_URI}

# Pushes the Docker image to ECR.
# docker tag kscale-store:latest ${WIKIBOT_ECR_URI}:latest
# docker push ${WIKIBOT_ECR_URI}:latest

# Runs the Docker image locally.
# docker run kscale-store:latest

0 comments on commit fde0d47

Please sign in to comment.