Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

main.yaml 3.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  1. name: workflow
  2. on:
  3. push:
  4. branches:
  5. - main
  6. paths-ignore:
  7. - 'README.md'
  8. permissions:
  9. id-token: write
  10. contents: read
  11. jobs:
  12. integration:
  13. name: Continuous Integration
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Checkout Code
  17. uses: actions/checkout@v3
  18. - name: Lint code
  19. run: echo "Linting repository"
  20. - name: Run unit tests
  21. run: echo "Running unit tests"
  22. build-and-push-ecr-image:
  23. name: Continuous Delivery
  24. needs: integration
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout Code
  28. uses: actions/checkout@v3
  29. - name: Install Utilities
  30. run: |
  31. sudo apt-get update
  32. sudo apt-get install -y jq unzip
  33. - name: Configure AWS credentials
  34. uses: aws-actions/configure-aws-credentials@v1
  35. with:
  36. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  37. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  38. aws-region: ${{ secrets.AWS_REGION }}
  39. - name: Login to Amazon ECR
  40. id: login-ecr
  41. uses: aws-actions/amazon-ecr-login@v1
  42. - name: Build, tag, and push image to Amazon ECR
  43. id: build-image
  44. env:
  45. ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
  46. ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY_NAME }}
  47. IMAGE_TAG: latest
  48. run: |
  49. # Build a docker container and
  50. # push it to ECR so that it can
  51. # be deployed to ECS.
  52. docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
  53. docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
  54. echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
  55. Continuous-Deployment:
  56. needs: build-and-push-ecr-image
  57. runs-on: self-hosted
  58. steps:
  59. - name: Checkout
  60. uses: actions/checkout@v3
  61. - name: Configure AWS credentials
  62. uses: aws-actions/configure-aws-credentials@v1
  63. with:
  64. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  65. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  66. aws-region: ${{ secrets.AWS_REGION }}
  67. - name: Login to Amazon ECR
  68. id: login-ecr
  69. uses: aws-actions/amazon-ecr-login@v1
  70. - name: Pull latest images
  71. run: |
  72. docker pull ${{secrets.AWS_ECR_LOGIN_URI}}/${{ secrets.ECR_REPOSITORY_NAME }}:latest
  73. # - name: Stop and remove container if running
  74. # run: |
  75. # docker ps -q --filter "name=cnncls" | grep -q . && docker stop cnncls && docker rm -fv cnncls
  76. - name: Run Docker Image to serve users
  77. run: |
  78. docker run -d -p 8080:8080 --name=cnncls -e 'AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}' -e 'AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}' -e 'AWS_REGION=${{ secrets.AWS_REGION }}' ${{secrets.AWS_ECR_LOGIN_URI}}/${{ secrets.ECR_REPOSITORY_NAME }}:latest
  79. - name: Clean previous images and containers
  80. run: |
  81. docker system prune -f
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...