Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wwei-github committed Nov 3, 2023
2 parents e4a4e06 + 7c40a94 commit 7185ae7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Production

on:
push:
branches:
- main

jobs:
build:
name: Build Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- 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-west-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: web3logo-backend
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: server1.lxdao.io
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
/root/apps/web3logo-backend.sh 653640199626.dkr.ecr.us-west-2.amazonaws.com/web3logo-backend:${{ github.sha }}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:16

# RUN apt-get update \
# && apt-get install -qq build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

WORKDIR /app/
COPY . .
RUN npm config set strict-ssl false \
&& npm install \
&& npm run build

EXPOSE 80
CMD [ "npm", "start" ]
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ async function bootstrap() {
app.useGlobalPipes(new ValidationPipe());
app.useGlobalInterceptors(new TransformInterceptor());

await app.listen(3000);
await app.listen(process.env.PORT || 3000);
}
bootstrap();

0 comments on commit 7185ae7

Please sign in to comment.