-
Notifications
You must be signed in to change notification settings - Fork 16
/
.gitlab-ci.yml
35 lines (31 loc) · 994 Bytes
/
.gitlab-ci.yml
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
image: "rust:latest"
stages:
- test
- build
- deploy
test:cargo:
stage: test
script:
- rustc --version && cargo --version
- cargo test --workspace --verbose
build:docker:
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- apk add --no-cache curl jq python3 py3-pip aws-cli
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_REGISTRY
script:
- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$CI_COMMIT_SHA -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$CI_COMMIT_SHA
- docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
deploy:ecs:
stage: deploy
image:
name: amazon/aws-cli
entrypoint: [""]
script:
- aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment
- aws ecs wait services-stable --cluster $ECS_CLUSTER --services $ECS_SERVICE
environment: production