forked from cybsafe/phishtray
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildspec.yml
57 lines (48 loc) · 3.16 KB
/
buildspec.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
version: 0.2
phases:
install:
commands:
# Installing and configure the ECS CLI on the build environment with the environment variables Encrypted
- echo INSTALLING ECS_CLI
- sudo curl -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest
- sudo chmod +x /usr/local/bin/ecs-cli
- ecs-cli -v
# configuring the ecs-cli for the cluster
- ecs-cli configure --cluster $cluster_name --default-launch-type FARGATE --region $aws_default_region --config-name $config_name
- ecs-cli configure profile --profile-name $profile_name --access-key $aws_access_key_id --secret-key $aws_secret_access_key
# # configuring the ecs-cli for the cluster
# ADD ENVIRONMENT VARIABLES AS NEEDED
# - ecs-cli configure --cluster $cluster_name --default-launch-type FARGATE --region $aws_default_region --config-name $config_name
# - ecs-cli configure profile --profile-name $profile_name --access-key $aws_access_key_id --secret-key $aws_secret_access_key
# # configuring the ecs-cli for the cluster
# - ecs-cli configure --cluster $cluster_name --default-launch-type FARGATE --region $aws_default_region --config-name $config_name
# - ecs-cli configure profile --profile-name $profile_name --access-key $aws_access_key_id --secret-key $aws_secret_access_key
- DATETIME=$(date +%d%m%y__%H%M)
- VERSION="$(git log --pretty=format:'%h' -n 1) $(date +%d:%m:%Y*****%H:%M)"
- echo $VERSION
pre_build:
commands:
# Login to the ECR to perform the pull and push of the images. Generate authentication code and use the same token to login to the ECR
- echo Logging.. in to Amazon ECR ....
- eval $(aws ecr get-login --region $aws_default_region --no-include-email)
build:
commands:
# @ build , tag and push the images to the repo
# - docker build -t cybsafe/phishtray:latest -f prod.Dockerfile .
# - docker tag cybsafe/phishtray:latest $aws_account_id.dkr.ecr.eu-west-2.amazonaws.com/phishtray/django:newlatest
# - docker push $aws_account_id.dkr.ecr.aws_default_region.amazonaws.com/phishtray/django:newlatest
post_build:
commands:
#--project-name is the task name, by default it uses this name as the task
# --File = docker compose file in the code directory
# --ecs-params = the parameters file which defines the container and the networking.
# --region = Region the definition needs to be spun up in.
# --launch-type FARGATE / EC2 cluster type #
#FOR EC2 LAUNCH TYPE
# - ecs-cli compose --project-name demo-django-compose --file docker-compose.yml --ecs-params ecs-params.yml --region $aws_default_region create --launch-type $launchtype
# - ecs-cli compose up --region $aws_default_region --cluster $dev --launch-type $launchtype
#FOR FARGATE***
# - cd ./docker/prod
- ecs-cli compose --file docker-compose.yml --ecs-params ecs-paramsEC2.yml --task-role-arn ecsTaskExecutionRole --region $aws_default_region create --launch-type $launchtype
- ecs-cli compose up --region $aws_default_region --cluster $dev --launch-type $launchtype
# - ecs-cli compose --region $aws_default_region --cluster $dev --launch-type $launchtype --file docker-compose.yml service up