Merge pull request #15 from tmwclaxton/staging #220
This file contains hidden or 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: "Production Deploy" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "master" ] | |
| env: | |
| AWS_REGION: "eu-west-2" | |
| ECR_REPOSITORY: "arbitrage-bot" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Build Docker image | |
| id: build-image | |
| env: | |
| ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
| ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} | |
| IMAGE_TAG: "latest" | |
| run: | | |
| export WWWUSER=${WWWUSER:-$UID} | |
| export WWWGROUP=${WWWGROUP:-$(id -g)} | |
| docker build --file DockerfileProd --build-arg WWWGROUP=${WWWGROUP} --build-arg WWWUSER=${WWWUSER} --tag arbitrage-bot/app . | |
| - name: Re-login to Amazon ECR | |
| id: re-login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Push Docker image | |
| id: push-image | |
| env: | |
| ECR_REGISTRY: ${{ steps.re-login-ecr.outputs.registry }} | |
| ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} | |
| IMAGE_TAG: "latest" | |
| run: | | |
| docker tag arbitrage-bot/app ${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG} | |
| docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG} | |
| echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT |