-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec-server-dev.yml
More file actions
48 lines (42 loc) · 1.95 KB
/
buildspec-server-dev.yml
File metadata and controls
48 lines (42 loc) · 1.95 KB
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
version: 0.2
env:
secrets-manager:
DOCKER_ID: "common/docker:DOCKER_ID"
DOCKER_PW: "common/docker:DOCKER_PW"
AWS_USER_ID: "common/docker:AWS_USER_ID"
phases:
pre_build:
commands:
- echo Logging in to Docker Hub...
- docker login -u $DOCKER_ID -p $DOCKER_PW
- echo Logging in to Amazon ECR...
- aws --version
- aws ssm get-parameter --with-decryption --name mossverse-game-backend-$NODE_ENV --region $AWS_DEFAULT_REGION | jq '.Parameter.Value' | sed 's/^.//;s/.$//' | perl -pe 's/\\n/\n/g' > ./Backend/.env.$NODE_ENV
- docker login --username AWS -p $(aws ecr get-login-password --region $AWS_DEFAULT_REGION) $AWS_USER_ID.dkr.ecr.ap-northeast-2.amazonaws.com/
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
- echo $NODE_ENV
build:
commands:
- echo Build started on `date`
- echo Building the Backend Docker image...
- docker build --build-arg NODE_ENV=$NODE_ENV -t dev_mossverse_game_server ./Backend
- docker tag dev_mossverse_game_server:latest $SERVER_ECR_ADDR:latest
- docker tag dev_mossverse_game_server:latest $SERVER_ECR_ADDR:$IMAGE_TAG
- echo Building the NGINX Docker image...
- docker build --build-arg NODE_ENV=$NODE_ENV -t dev_mossverse_game_server_nginx ./Nginx
- docker tag dev_mossverse_game_server_nginx:latest $SERVER_NGINX_ECR_ADDR:latest
- docker tag dev_mossverse_game_server_nginx:latest $SERVER_NGINX_ECR_ADDR:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Backend Docker images...
- docker push $SERVER_ECR_ADDR:latest
- docker push $SERVER_ECR_ADDR:$IMAGE_TAG
- echo Pushing the Nginx Docker images...
- docker push $SERVER_NGINX_ECR_ADDR:latest
- docker push $SERVER_NGINX_ECR_ADDR:$IMAGE_TAG
artifacts:
files:
- appspec-server-dev.yaml
- taskdef-server.dev.json