Skip to content

Commit 38121a7

Browse files
Jonatas Baldinekarson
Jonatas Baldin
authored andcommitted
Add Dockerfile and related changes to build the Docker image (twilio#358)
* Add Dockerfile and related changes to build the Docker image * Add README section about Dockerfile and correct api definitions tag * Fix TravisCI configuration, fix docker-push TAG and add more secure way to log into DockerHub * Add Docker service in TravisCI * Update Makefile
1 parent 1bd5ed6 commit 38121a7

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

.travis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ node_js:
55
- "node"
66
- "8"
77
- "6"
8+
services:
9+
- docker
810
script: npm run ci
911
notifications:
1012
slack:
@@ -13,3 +15,10 @@ notifications:
1315
rooms:
1416
- secure: WDSJTf0kyen9YY7PH4PPc6LftE5w+YH825dX0qUF/3C+U4/qKW9D7U2z+bsbqi0Ir3cGObN6iK73O18E7N4L3vV1eyCj3ds7eyU9/YBroegz8+4KXw89n4lUVGo4jjIp9tzPgqmRdk5S0Flr/wc1HM9+VlnHFN5gE0P7Vui8bbc=
1517
- secure: IlvaufTODSJPN3aIeQV4k/9c0YVRReCK4GAkBUj6Q9rMEJ9XQaSC3x5O0i1CM2cODWqfQsqVkII92LJy/Q8bbvIVW6ZYLy5aYi+EIiHAZMZkPb+kyIS97uDeYGL4Oo9OteGftNCIQTIpqu5WwWDx9cu9IoX9Qb19lO6chkCBo2I=
18+
deploy:
19+
provider: script
20+
script: make docker-build && make docker-push
21+
skip_cleanup: true
22+
on:
23+
tags: true
24+
node: "8"

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:8
2+
3+
RUN mkdir /twilio
4+
WORKDIR /twilio
5+
6+
ENV NODE_PATH /usr/local/lib/node_modules
7+
8+
COPY lib ./lib
9+
COPY index.js .
10+
COPY package* ./
11+
12+
RUN npm install . -g

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ docs:
1515

1616
clean: node_modules
1717
rm -rf node_modules
18+
19+
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
20+
docker-build:
21+
docker build -t twilio/twilio-node .
22+
docker tag twilio/twilio-node twilio/twilio-node:${TRAVIS_TAG}
23+
docker tag twilio/twilio-node twilio/twilio-node:apidefs-${API_DEFINITIONS_SHA}
24+
25+
docker-push:
26+
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
27+
docker push twilio/twilio-node:${TRAVIS_TAG}
28+
docker push twilio/twilio-node:apidefs-${API_DEFINITIONS_SHA}

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ For detailed usage information and API docs, head out here:
2323

2424
[https://www.twilio.com/docs/libraries/node](https://www.twilio.com/docs/libraries/node)
2525

26+
## Docker Image
27+
28+
The `Dockerfile` present in this repository and its respective `twilio/twilio-node` Docker image are currently used by Twilio for testing purposes only.
29+
2630
## Getting help
2731

2832
If you need help installing or using the library, please contact Twilio Support at [email protected] first. Twilio's Support staff are well-versed in all of the Twilio Helper Libraries, and usually reply within 24 hours.

0 commit comments

Comments
 (0)