-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (54 loc) · 1.95 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
include .env
# speed up builds and improve build UI by enabling Docker Buildkit
export DOCKER_BUILDKIT=1
# starts a local production demo
demo:
docker run --rm -p ${PORT}:${PORT} --name ${PROJECT_NAME}-demo \
guillermomaschwitz/${PROJECT_NAME}:${PROJECT_VERSION}-production
# start development environment
start:
docker-compose up
# stop development environment
stop:
docker-compose stop
# run any command inside an ephemeral container
run:
@read -p "Write a command to run inside a disposable development container: " command; \
docker-compose run --rm ${PROJECT_NAME} \
sh -c "$$command"
# run any command inside an ephemeral container
exec:
@read -p "Write a command to run inside a disposable development container: " command; \
docker-compose exec ${PROJECT_NAME} \
sh -c "$$command"
# build docker images
build:
-rm -rf ./${PROJECT_NAME}/node_modules
docker build -f ./docker/Dockerfile -t guillermomaschwitz/${PROJECT_NAME}:${PROJECT_VERSION} \
-t guillermomaschwitz/${PROJECT_NAME}:${PROJECT_VERSION}-production \
--target prod \
--build-arg PORT=${PORT} \
--build-arg PROJECT_NAME=${PROJECT_NAME} \
./${PROJECT_NAME}
docker build -f ./docker/Dockerfile -t guillermomaschwitz/${PROJECT_NAME}:${PROJECT_VERSION}-development \
--target dev \
--build-arg PORT=${PORT} \
--build-arg PROJECT_NAME=${PROJECT_NAME} \
./${PROJECT_NAME}
# install third party libraries required by dev environment
setup:
docker-compose run --rm ${PROJECT_NAME} yarn
# wipe any docker image and containers
clean:
docker-compose down --rmi all
docker image rm -f guillermomaschwitz/${PROJECT_NAME}:${PROJECT_VERSION}
docker image rm -f guillermomaschwitz/${PROJECT_NAME}:${PROJECT_VERSION}-production
# open a sh session inside the container
sh:
docker-compose exec ${PROJECT_NAME} sh
# deploy to AWS S3 + Cloudfront
#deploy:
# push docker image to my DockerHub public repo
push:
docker login -u guillermomaschwitz
docker push guillermomaschwitz/${PROJECT_NAME}