diff --git a/.ebextensions/01_build_frontend.config b/.ebextensions/01_build_frontend.config deleted file mode 100644 index a40161c1..00000000 --- a/.ebextensions/01_build_frontend.config +++ /dev/null @@ -1,6 +0,0 @@ -# .ebextensions/01_build_frontend.config - -container_commands: - 01_build_frontend: - command: "bash scripts/build_frontend.sh" - leader_only: true diff --git a/.ebextensions/02_wsgi.config b/.ebextensions/02_wsgi.config deleted file mode 100644 index 921cb4ce..00000000 --- a/.ebextensions/02_wsgi.config +++ /dev/null @@ -1,13 +0,0 @@ -# .ebextensions/02_wsgi.config - -option_settings: - aws:elasticbeanstalk:application:environment: - PYTHONPATH: "/var/app/current:$PYTHONPATH" - aws:elasticbeanstalk:container:python: - WSGIPath: "store.app.main:application" - -# Commented out because we don't have a database yet -# container_commands: -# 01_initdb: -# command: "source /var/app/venv/*/bin/activate && python3 init_db.py" -# leader_only: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8ddc7e33..1e6c5960 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -47,7 +47,32 @@ jobs: npm run build working-directory: frontend - # Fail for now - - name: Fail + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_NAME }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Log in to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push Docker image + env: + ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }} + IMAGE_TAG: latest run: | - exit 1 + docker buildx build --platform linux/amd64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f docker/Dockerfile . --push + + # - 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