Skip to content

fix: get appropriate client ip from nginx proxy using headers #130

fix: get appropriate client ip from nginx proxy using headers

fix: get appropriate client ip from nginx proxy using headers #130

Workflow file for this run

name: Develop deploy workflow
on:
workflow_dispatch:
push:
branches:
- 'develop'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: yarn run test
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- 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_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Push Image to AWS ECR Public Repo
id: ecr-image-push
run: |
aws ecr-public get-login-password --region ${{ secrets.AWS_PUBLIC_REPO_REGION }} | docker login --username AWS --password-stdin public.ecr.aws/${{ secrets.AWS_ACCOUNT_ID }}
docker build -t ${{ secrets.DEV_ECR_REPO }}:latest .
docker tag ${{ secrets.DEV_ECR_REPO }}:latest public.ecr.aws/${{ secrets.AWS_ACCOUNT_ID }}/${{ secrets.DEV_ECR_REPO }}:latest
docker push public.ecr.aws/${{ secrets.AWS_ACCOUNT_ID }}/${{ secrets.DEV_ECR_REPO }}:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: ssh command deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.PEM_KEY }}
script: |
sudo docker stop dev-server
sudo docker rm dev-server
sudo docker rm -f $(docker ps -qa)
sudo docker image prune -a -f
sudo docker pull public.ecr.aws/${{ secrets.AWS_ACCOUNT_ID }}/${{ secrets.DEV_ECR_REPO }}:latest
sudo docker run --name dev-server --env-file .env -d -p 3000:3000 -t public.ecr.aws/${{ secrets.AWS_ACCOUNT_ID }}/${{ secrets.DEV_ECR_REPO }}:latest