You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. name: lektura-red
  2. kind: pipeline
  3. type: docker
  4. steps:
  5. - name: backend-build
  6. image: golang:1.15
  7. depends_on: []
  8. commands:
  9. - go mod download
  10. - CGO_ENABLED=0 go build -ldflags "-w -s" -o build/api/handler cmd/stufflog2-lambda/main.go
  11. - name: backend-test
  12. image: golang:1.15
  13. depends_on: []
  14. commands:
  15. - go test -v ./...
  16. - name: backend-migrate
  17. image: golang:1.15
  18. depends_on: []
  19. environment:
  20. DB_CONNECT:
  21. from:secret: db_connect
  22. commands:
  23. - go get -u github.com/pressly/goose/...
  24. - cd migrations/postgres
  25. - goose postgres $DB_CONNECT up
  26. - name: backend-deploy
  27. image: node:14.14.0
  28. depends_on:
  29. - backend-build
  30. - backend-test
  31. - backend-migrate
  32. environment:
  33. AWS_ACCESS_KEY_ID:
  34. from_secret: aws_access_key_id
  35. AWS_SECRET_ACCESS_KEY:
  36. from_secret: aws_secret_access_key
  37. AWS_DEFAULT_REGION:
  38. from_secret: aws_region
  39. AMI_ROLE:
  40. from_secret: ami_role
  41. S3_WEBUI_BUCKET:
  42. from_secret: s3_webui_bucket
  43. DOMAIN_NAME:
  44. from_secret: domain_name
  45. CERTIFICATE_NAME:
  46. from_secret: certificate_name
  47. CERTIFICATE_ARN:
  48. from_secret: certificate_arn
  49. HOSTED_ZONE_ID:
  50. from_secret: hosted_zone_id
  51. DB_DRIVER:
  52. from_secret: db_driver
  53. DB_CONNECT:
  54. from:secret: db_connect
  55. commands:
  56. - apt-get update > /dev/null 2>&1
  57. - apt-get -y install awscli zip > /dev/null 2>&1
  58. - npm install -g serverless > /dev/null 2>&1
  59. - npm install -g serverless-domain-manager > /dev/null 2>&1
  60. - npm install -g serverless-apigateway-service-proxy > /dev/null 2>&1
  61. - serverless deploy
  62. - name: frontend-build
  63. image: node:14.14.0
  64. depends_on: []
  65. environment:
  66. AWS_AMPLIFY_REGION:
  67. from_secret: aws_region
  68. AWS_AMPLIFY_USER_POOL_ID:
  69. from_secret: aws_amplify_user_pool_id
  70. AWS_AMPLIFY_USER_POOL_WEB_CLIENT_ID:
  71. from_secret: aws_amplify_user_pool_web_client_id
  72. commands:
  73. - cd svelte-ui
  74. - echo AWS_AMPLIFY_USER_POOL_ID=$AWS_AMPLIFY_USER_POOL_ID > build.env
  75. - echo AWS_AMPLIFY_USER_POOL_WEB_CLIENT_ID=AWS_AMPLIFY_USER_POOL_WEB_CLIENT_ID >> build.env
  76. - npm install
  77. - npm run build
  78. - name: frontend-deploy
  79. image: amazon/aws-cli:latest
  80. depends_on:
  81. - frontend-build
  82. environment:
  83. AWS_ACCESS_KEY_ID:
  84. from_secret: aws_access_key_id
  85. AWS_SECRET_ACCESS_KEY:
  86. from_secret: aws_secret_access_key
  87. AWS_DEFAULT_REGION:
  88. from_secret: aws_region
  89. S3_WEBUI_BUCKET:
  90. from_secret: s3_webui_bucket
  91. commands:
  92. - cd svelte-ui/public
  93. - aws s3 sync . s3://$S3_WEBUI_BUCKET