Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module2 example1 #117

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
node_js:
- "8.3"

sudo: required
services:
- docker
before_install:
-docker pull node:8-onbuild

install:
-docker build -t probot-hello

script:
-docker run --rm probot-hello npm run test
-docker run --rm probot-hello npm run lint
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# https://hub.docker.com/_/node/
FROM node:8-onbuild

# use debug to troubleshoot
ENV LOG_LEVEL=error
# Required env settings determined by GitHub App
ENV APP_ID=1234
ENV WEBHOOK_SECRET=development
ENV WEBHOOK_PROXY_URL=https://localhost:3000/
ENV PRIVATE_KEY="someprivatestring"

# see https://github.com/nodejs/docker-node/blob/e3ec2111af089e31321e76641697e154b3b6a6c3/docs/BestPractices.md#global-npm-dependencies
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$PATH:/home/node/.npm-global/bin

# Lets install our app into /home/node
COPY . /home/node/probot-hello
RUN chown -R node:node /home/node/probot-hello

# setup our app
# non-root user https://github.com/nodejs/docker-node/blob/e3ec2111af089e31321e76641697e154b3b6a6c3/docs/BestPractices.md#non-root-user
USER node

WORKDIR /home/node/probot-hello
RUN npm install
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ npm install
npm start
```

There are some useful hacking commands [here](/docs/HACKING.md).

## Contributing

If you have suggestions for how probot-hello could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
Expand Down
41 changes: 41 additions & 0 deletions docs/HACKING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Build locally
`docker build -t probot-hello .`

# Test the project
`docker run -it --rm probot-hello npm run test`

# Test out running locally

This starts things up locally without connecting to a GitHub App.

```
docker run -it --rm \
-e NODE_ENV=dev \
-e APP_ID=aaa \
-e WEBHOOK_SECRET=bbb \
-e PRIVATE_KEY=$(echo abcd|base64) \
-p 3000:3000 probot-hello npm start
```

Try opening a browser to http://localhost:3000 to see the probot web start.

# Develop locally

Changes to your source code get reflected in the container and node restarts
our app with the latest changes.

```
docker run -it --rm \
-e APP_ID=abc \
-e PRIVATE_KEY=none \
-w /home/node/probot-hello-dev \
-v "$(pwd)":/home/node/probot-hello-dev \
-p 3000:3000 probot-hello \
bash -c 'npm install && npm run dev'
```

# Lint Test
`docker run -it --rm probot-hello npm run lint`

# Show Coverage Report
`docker run -it --rm probot-hello npm run coverage`
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
"start": "probot run ./index.js",
"lint": "standard --fix",
"test": "jest && standard",
"coverage": "jest --coverage",
"test:watch": "jest --watch --notify --notifyMode=change --coverage"
},
"dependencies": {
"probot": "^7.0.0"
"dev": "^0.1.3",
"probot": "^7.0.0",
"run": "^1.4.0"
},
"devDependencies": {
"jsdom": "11.11.0",
Expand Down