-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
50 lines (49 loc) · 1.88 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
version: 0.2
env:
variables:
ECR_BASE: 241078504042.dkr.ecr.us-east-1.amazonaws.com
PROJECT_NAME: ds4a-dash-app
PROJECT_REPO: /ds4a-run-dash
VERSION: 0.0.3
ENV_CONTAINER: 241078504042.dkr.ecr.us-east-1.amazonaws.com/base-images:latest
phases:
install:
runtime-versions:
python: 3.9
commands:
- echo starting build prod branch
- export STARTINGPOINT=$(pwd)
- echo $STARTINGPOINT
- pip install awscli pyyaml
pre_build:
commands:
- echo starting process
- export ECR_REPO=${ECR_BASE}${PROJECT_REPO}
- echo $ECR_REPO
- echo starting copy folders
- cd aws_env
- cp -R ../assets assets
- cp -R ../components components
- cp -R ../environment environment
- cp -R ../layout layout
- cp -R ../pages pages
- cp -R ../utils utils
- cp ../requirements.txt requirements.txt
- cp ../routes.py routes.py
- cp ../index.py index.py
- cp ../app.py app.py
- echo logging in to Project AWS ECR...
- aws --region ${AWS_DEFAULT_REGION} ecr get-login-password | docker login --password-stdin --username AWS "${ECR_BASE}"
- echo logging into ${ECR_REPO}
build:
commands:
- echo ------------CREATING IMAGE---------------------
- echo swapping current image from release to rollback
- docker pull ${ECR_REPO}:${PROJECT_NAME}_release || true
- docker tag ${ECR_REPO}:${PROJECT_NAME}_release ${ECR_REPO}:${PROJECT_NAME}_rollback || true
- echo this is an image creation
- docker build -t ${ECR_REPO}:${PROJECT_NAME}-${VERSION} -t ${ECR_REPO}:${PROJECT_NAME}_release --build-arg ENV_CONTAINER=$ENV_CONTAINER .
- docker push ${ECR_REPO}:${PROJECT_NAME}-${VERSION}
- docker push ${ECR_REPO}:${PROJECT_NAME}_release
- docker push ${ECR_REPO}:${PROJECT_NAME}_rollback || true
- echo created image