-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
44 lines (31 loc) · 1.22 KB
/
Makefile
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
PROJECT ?= douitsu
EB_BUCKET ?= ninjablocks-sphere-docker
APP_NAME ?= sphere-douitsu
APP_ENV ?= sphere-douitsu-prod
CONFIG ?= configs/options.sphere.mine.js
SHA1 := $(shell git rev-parse --short HEAD | tr -d "\n")
DOCKERRUN_FILE := Dockerrun.aws.json
APP_FILE := ${SHA1}.zip
all: build
build:
# TODO not do this here.. needs to be configurable via env var
cp ${CONFIG} options.mine.js
docker build ${BUILD_OPTS} -t "ninjasphere/${PROJECT}:${SHA1}" .
echo "built...${PROJECT}:${SHA1}"
push:
docker push "ninjasphere/${PROJECT}:${SHA1}"
local:
docker run -p 3333:3333 -t "ninjasphere/${PROJECT}:${SHA1}"
deploy:
sed "s/<TAG>/${SHA1}/" < Dockerrun.aws.json.template > ${DOCKERRUN_FILE}
zip -r ${APP_FILE} ${DOCKERRUN_FILE} .ebextensions
aws s3 cp ${APP_FILE} s3://${EB_BUCKET}/${APP_ENV}/${APP_FILE}
aws elasticbeanstalk create-application-version --application-name ${APP_NAME} \
--version-label ${SHA1} --source-bundle S3Bucket=${EB_BUCKET},S3Key=${APP_ENV}/${APP_FILE}
# # Update Elastic Beanstalk environment to new version
aws elasticbeanstalk update-environment --environment-name ${APP_ENV} \
--version-label ${SHA1}
clean:
rm *.zip || true
rm ${DOCKERRUN_FILE} || true
.PHONY: all build local deploy clean