-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# build-docker-dev | ||
build-docker-dev: | ||
cp -r project docker/dev/ | ||
cp package.json docker/dev/ | ||
cp Makefile docker/dev/ | ||
cp run-prod.sh docker/dev/ | ||
cd docker/dev/ && docker build -t "platzi/oss" . | ||
rm -rf docker/dev/project | ||
rm docker/dev/package.json | ||
rm docker/dev/Makefile | ||
rm docker/dev/run-prod.sh | ||
|
||
# Run the microservice in the port 8000 | ||
start: | ||
npm run start:prod | ||
|
||
start-dev: | ||
cd docker/dev/ && docker-compose up -d | ||
|
||
stop-dev: | ||
cd docker/dev/ && docker-compose stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node:wheezy | ||
RUN mkdir /app | ||
ADD project/ /app | ||
WORKDIR /app | ||
COPY package.json /app | ||
RUN npm install | ||
CMD ["npm", "run", "start:prod"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '2' | ||
services: | ||
# oss | ||
oss: | ||
image: platzi/oss | ||
container_name: platzi-oss | ||
ports: | ||
- 9696:8000 | ||
networks: | ||
platzi: | ||
aliases: | ||
- platzi-oss | ||
networks: | ||
platzi: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
make start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
make start-dev | ||
|
||
case "$(uname -s)" in | ||
|
||
Darwin) | ||
export DOCKER_IP="$(dinghy ip)" | ||
;; | ||
|
||
Linux) | ||
export DOCKER_IP='localhost' | ||
;; | ||
*) | ||
export DOCKER_IP='localhost' | ||
;; | ||
esac | ||
|
||
sleep 1s | ||
API_STATUS=`curl -i -X GET http://$DOCKER_IP:9001/apis/oss/|awk 'NR==1{print $2}'` | ||
if [ $API_STATUS != 200 ]; then | ||
echo "registering oss on kong" | ||
curl -i -X POST \ | ||
--url http://$DOCKER_IP:9001/apis/ \ | ||
--data 'name=oss' \ | ||
--data 'upstream_url=http://platzi-oss:8000/' \ | ||
--data 'request_path=/oss' \ | ||
--data 'strip_request_path=true' \ | ||
--data 'preserve_host=false' \ | ||
> /dev/null | ||
fi |