Skip to content

added demonet private key for user testing (#8) #18

added demonet private key for user testing (#8)

added demonet private key for user testing (#8) #18

Workflow file for this run

name: Deploy JS cli wrapper
on:
push:
branches:
- main
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
context: app
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: 'true'
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
run: |
docker build \
-t $ECR_REPOSITORY \
.
docker tag $ECR_REPOSITORY:latest $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Deploy to EC2 instance
uses: appleboy/ssh-action@master
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: ECR_REGISTRY,ECR_REPOSITORY
script_stop: true
script: |
docker stop js-cli-wrapper || true
docker rm js-cli-wrapper || true
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $ECR_REGISTRY
docker system prune -af
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker run \
-d \
--restart always \
-p 80:3000 \
--name js-cli-wrapper \
-v /tmp/lilypad/data:/tmp/lilypad/data \
$ECR_REGISTRY/$ECR_REPOSITORY:latest