use pm2 for node process management in docker (#470) #20
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: Docker Image CI | |
| on: | |
| push: | |
| # branches: [ "master", "main", "migrate_docker_files"] | |
| branches: ["master", "main"] | |
| permissions: | |
| contents: read | |
| jobs: | |
| docker_build: | |
| name: Build images and deploy contracts | |
| strategy: | |
| matrix: | |
| env: ["prod"] | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout ethlance code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| id: setup-qemu | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| id: setup-buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Configure AWS Credentials | |
| 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: ${{ secrets.AWS_DEFAULT_REGION }} | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Checkout ethlance-configs repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: district0x/ethlance-config | |
| path: ethlance-config | |
| token: ${{ secrets.ETHLANCE_CONFIG_PAT }} | |
| ref: master | |
| - name: check configs | |
| run: | | |
| # cp -r ethlance-config/config . | |
| ls -lah | |
| ls -lah ethlance-config | |
| - name: Build and push Server | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| builder: ${{ steps.setup-buildx.outputs.name }} | |
| platforms: linux/amd64,linux/arm64 | |
| file: docker-builds/server/Dockerfile | |
| build-args: | | |
| ETHLANCE_ENV=${{ matrix.env }} | |
| ETHLANCE_DEPLOY_SEED=${{ secrets.ETHLANCE_DEPLOY_SEED }} | |
| DOCKER_REGISTRY=${{ secrets.ECR_REGISTRY }} | |
| push: true | |
| tags: | | |
| ${{ secrets.ECR_REGISTRY }}/ethlance-${{ matrix.env }}-server:${{ github.sha }} | |
| ${{ secrets.ECR_REGISTRY }}/ethlance-${{ matrix.env }}-server:latest | |
| - name: Build and push UI | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| builder: ${{ steps.setup-buildx.outputs.name }} | |
| file: docker-builds/ui/Dockerfile | |
| build-args: | | |
| ETHLANCE_ENV=${{ matrix.env }} | |
| ETHLANCE_DEPLOY_SEED=${{ secrets.ETHLANCE_DEPLOY_SEED }} | |
| DOCKER_REGISTRY=${{ secrets.ECR_REGISTRY }} | |
| push: true | |
| tags: | | |
| ${{ secrets.ECR_REGISTRY }}/ethlance-${{ matrix.env }}-ui:${{ github.sha }} | |
| ${{ secrets.ECR_REGISTRY }}/ethlance-${{ matrix.env }}-ui:latest |