-
Notifications
You must be signed in to change notification settings - Fork 0
/
ii-build.yml
51 lines (51 loc) · 1.9 KB
/
ii-build.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
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
commands:
- python --version
pre_build:
commands:
- export STARTTIME=`date +%s`
- export BUILDNAME="$GIT_BRANCH-`date +%Y-%m-%d`"
- export BRANCH="$GIT_BRANCH"
- export SOURCE_VERSION="$CODEBUILD_SOURCE_VERSION"
- echo "BRANCH $BRANCH"
- echo "SOURCE_VERSION $SOURCE_VERSION"
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- IMAGE_TAG=build-$(git rev-parse HEAD)
build:
commands:
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- apt-get -y update
- apt-get install -y nfs-common
- echo Build started on `date`
- echo Building the Docker image...
- echo $REPOURL:latest $REPOURL:$IMAGE_TAG
- docker build -t improved-initiative --build-arg PORT=$PORT --build-arg DB_CONNECTION_STRING=$DB_CONNECTION_STRING ./improved-initiative/
- docker tag improved-initiative:latest $REPOURL:latest
- docker tag improved-initiative:latest $REPOURL:$IMAGE_TAG
- docker images
- docker create improved-initiative
- CONTAINER=$(docker ps -a | grep improved-initiative | awk '{print $1}')
- docker ps -a
- echo $CONTAINER
- mkdir public
- mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport $II_EFS:/ ./public/
- docker cp -a $CONTAINER:/usr/src/app/public/ ./public/
- chown 1000:1000 -R .
- sleep 3
- echo Pushing the Docker images...
- echo $REPOURL/improved-initiative:latest $REPOURL:$IMAGE_TAG
- docker push $REPOURL:latest
- docker push $REPOURL:$IMAGE_TAG
- aws ecs update-service --force-new-deployment --service improved-initiative --cluster ttrpg-cluster
post_build:
commands:
- echo Build completed on `date`
- pwd
- ls -al
artifacts:
files:
- '**/*'