-
Notifications
You must be signed in to change notification settings - Fork 6
/
deploy.sh
42 lines (30 loc) · 861 Bytes
/
deploy.sh
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
#!/bin/bash
export AWS_ACCESS_KEY_ID=$1
export AWS_SECRET_ACCESS_KEY=$2
export AWS_REGION=$3
export AWS_ECR_REPOSITORY=$4
# Login to docker registry
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ECR_REPOSITORY
# Stopping docker compose
docker-compose stop
# Coping old docker-compose.yml
cp docker-compose.yml docker-compose.old.yml
# Coping old env file
cp .env .env.old
# Adding new .env file
mv .env.ci.dist .env
# Adding new docker-compose.yml file
mv docker-compose.prod.yml docker-compose.yml
# Pulling new image from registry
docker-compose pull
# Starting application
docker-compose up -d
# logout from docker registry
docker logout
# unset env variables
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_REGION
unset IAM_CACHE_SERVER_IMAGE
# remove deploy.sh
# rm deploy.sh