[英]How to setup deploy nodejs app using jenkins docker container in aws ec2
[英]How to deploy and angular app using GitHubActions to EC2 with Yarn as the package manager?
我在博客的帮助下编写了一个 yaml 脚本,其中包含将我的应用程序部署到运行 ubuntu 的 ec2 实例所需执行的所有必要工作。NGINX 已安装并正在运行。 不幸的是,我的 yaml 脚本无声地失败了,我不知道出了什么问题,这是脚本中的代码
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
# using Ubuntu
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Install Angular CLI
uses: borales/actions-yarn@v4
with:
cmd: yarn global add @angular/cli
- name: Build production bundle
uses: borales/actions-yarn@v4
with:
cmd: build:prod # will run `yarn build:prod` command
- name: Deploy to my EC2 instance
uses: easingthems/ssh/deploy@2.1.5
with:
SSH_PRIVATE_KEY: $ {{ secrets.SSH_PRIVATE_KEY }} # I have the SSH_Private key of the instance saved as secrets in GitHub under the repository settings.
SOURCE: "dist/my-client-app"
REMOTE_HOST: "my-remote-host" # here I used my instances's IP Address. Not sure if that is what I am supposed to put there.
REMOTE_USER: "ubuntu"
TARGET: "/var/www/html/my-client-app"
谁能指出这里的问题是什么?
这是构建、测试 Angular 应用程序并将其部署到 AWS S3 的工作流示例:
jobs:
build-test-deploy:
runs-on: ubuntu-latest
steps:
- 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: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm install
- name: test # this section runs tests
run: npm run test
- name: Build
run: npm run build
- name: Deploy
if: success()
run: aws s3 sync ./dist/app/ s3://your-bucket-name
我只是想让你知道,我最终使用了 Amplify,这要容易得多。 最后没有推荐的答案有效。 linux ubuntu EC2 仍然给我带来问题。 它升级为 ng build not found 但环境已设置好一切,所以 yaa。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.