forked from LukeMwila/multi-container-nginx-react-node-mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
32 lines (32 loc) · 1.32 KB
/
buildspec.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
version: 0.2
phases:
install:
runtime-versions:
docker: 18
pre_build:
commands:
- echo Build client and backend docker images for testing...
- docker build -t lukondefmwila/react-test -f ./client/Dockerfile.dev ./client
- docker build -t lukondefmwila/nodejs-test -f ./backend/Dockerfile.dev ./backend
build:
commands:
- echo Build started on `date`
# Run tests with built Docker images
- echo Run react tests...
- docker run -e CI=true lukondefmwila/react-test
- echo Run nodejs tests...
- docker run -e CI=true lukondefmwila/nodejs-test
# Build the Docker images
- echo Building the production Docker image...
- docker build -t lukondefmwila/dkr-multicontainer-app-client ./client
- docker build -t lukondefmwila/dkr-multicontainer-app-backend ./backend
- docker build -t lukondefmwila/dkr-multicontainer-app-nginx ./nginx
# Log in to the Docker CLI
- echo "$DOCKER_PW" | docker login -u "$DOCKER_ID" --password-stdin
post_build:
commands:
# Take these images and push them to Docker hub
- echo Pushing the Docker images...
- docker push lukondefmwila/dkr-multicontainer-app-client
- docker push lukondefmwila/dkr-multicontainer-app-backend
- docker push lukondefmwila/dkr-multicontainer-app-nginx