feat: add AWS App Runner deployment support

- Update Dockerfile CMD to fix HOSTNAME binding for App Runner
- Add ECR push step to GitHub Actions for auto-deploy
- Add .env*.local to gitignore
This commit is contained in:
dayuan.jiang
2025-12-15 15:48:33 +09:00
parent 44840d27b3
commit c527ce1520
3 changed files with 24 additions and 2 deletions

View File

@@ -64,3 +64,24 @@ jobs:
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
# Push to AWS ECR for App Runner auto-deploy
- name: Configure AWS credentials
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
- name: Login to Amazon ECR
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Push to ECR (triggers App Runner auto-deploy)
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
run: |
docker pull ghcr.io/${{ github.repository }}:latest
docker tag ghcr.io/${{ github.repository }}:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.ap-northeast-1.amazonaws.com/next-ai-draw-io:latest
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.ap-northeast-1.amazonaws.com/next-ai-draw-io:latest

1
.gitignore vendored
View File

@@ -46,3 +46,4 @@ push-via-ec2.sh
.dev.vars .dev.vars
.open-next/ .open-next/
.wrangler/ .wrangler/
.env*.local

View File

@@ -54,6 +54,6 @@ EXPOSE 3000
ENV PORT=3000 ENV PORT=3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
# Start the application # Start the application (HOSTNAME override needed for AWS App Runner)
CMD ["node", "server.js"] CMD ["sh", "-c", "HOSTNAME=0.0.0.0 exec node server.js"]