fix: fixing deployment #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy SAM | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
AWS_REGION: "us-east-1" | |
AWS_ACCOUNT_ID: "117819748843" | |
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
permissions: | |
contents: read | |
jobs: | |
deploy_docker_image: | |
name: Deploy Docker Image | |
runs-on: ubuntu-latest | |
environment: production | |
container: | |
image: public.ecr.aws/sam/build-python3.7:latest #continuumio/miniconda3 #public.ecr.aws/sam/build-python3.9:latest #continuumio/miniconda3 #public.ecr.aws/sam/build-python3.7:latest #public.ecr.aws/sam/build-python3.9:latest #amazonlinux:2 # | |
steps: | |
- name: Checkout | |
uses: taiki-e/checkout-action@v1 | |
- name: Build python package | |
run: | | |
pip install venv-pack awscli build | |
python -m build --sdist ./ | |
- name: build and push | |
uses: vitr/actions-build-and-upload-to-ecs@master | |
with: | |
access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
account_id: ${{ env.AWS_ACCOUNT_ID }} | |
repo: emr-serverless | |
region: ${{ env.AWS_REGION }} | |
tags: satellite-image-etl | |
create_repo: false | |
- name: Copy Python files to S3 deployment zone | |
run: | | |
aws s3 cp spark_entrypoint.py s3://deployment-zone-${AWS_ACCOUNT_ID}-${AWS_REGION}/satellite_image_etl/ | |
deploy_sam: | |
name: Deploy SAM template | |
runs-on: ubuntu-latest | |
environment: production | |
container: | |
image: public.ecr.aws/sam/build-python3.9:latest | |
steps: | |
- name: Checkout | |
uses: taiki-e/checkout-action@v1 | |
- name: SAM build | |
run: sam build | |
- name: SAM deploy | |
run: > | |
sam deploy | |
--no-fail-on-empty-changeset | |
--on-failure DELETE | |
--stack-name satellite-image-etl-stack | |
--region ${AWS_REGION} | |
--capabilities CAPABILITY_AUTO_EXPAND | |
--s3-bucket deployment-zone-${AWS_ACCOUNT_ID}-${AWS_REGION} | |
--s3-prefix ${{ github.event.repository.name }} |