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

Add docker and CI configuration #183

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.github
demo
example
middleware
dist
typings
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,27 @@ jobs:

- name: Build release
run: npm run build:release

buildAndPushDockerImage:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push image
uses: docker/build-push-action@v2
with:
context: .
tags: dhcenter/graphql-voyager:latest
push: ${{ github.ref == 'refs/heads/master' }}
file: docker/Dockerfile
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Middleware supports the following properties:
- `displayOptions` [`object`] - same as [here](#properties)
- `headersJS` [`string`, default `"{}"`] - object of headers serialized in string to be used on endpoint url<BR>
**Note:** You can also use any JS expression which results in an object with header names as keys and strings as values e.g. `{ Authorization: localStorage['Meteor.loginToken'] }`
- `credentials` [`string`, default `"same-origin"`] - sets `credentials` property for introspection query

### Express

Expand Down
16 changes: 16 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:14.15.4-alpine3.11

WORKDIR /usr/src/app

COPY package.json package-lock.json ./

RUN npm install

COPY . .

RUN npm run build:release

RUN cd docker && npm install

CMD ["node", "docker/server.js"]

21 changes: 21 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Running as Docker container

You can use `graphql-voyager` without any changes in your code, by running it as a Docker container.

1. Create `docker-compose.yml` file
2. Paste following content in it:

```yaml
version: '3.2'
services:
voyager:
image: dhcenter/graphql-voyager:latest
ports:
- 3400:3400
restart: always
environment:
GRAPHQL_ENDPOINT: https://api.st-retrospect.dh-center.ru/graphql
```

3. Change necessary environment variables
4. Run with `docker-compose up`
Loading