Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Include a Dockerfile and instructions. #15

Merged
merged 6 commits into from Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
@@ -0,0 +1 @@
node_modules
16 changes: 16 additions & 0 deletions Dockerfile
@@ -0,0 +1,16 @@
FROM node:12
# docker build -t sourcecred-widgets .

# Set up working directory.
RUN mkdir -p /code
WORKDIR /code

# Install global and local dependencies first so they can be cached.
RUN npm install -g yarn@^1.17
COPY package.json yarn.lock /code/
RUN yarn

# Install the remainder of our code.
COPY . /code

ENTRYPOINT ["/code/bin/contributor-wall-svg.js"]
24 changes: 21 additions & 3 deletions README.md
Expand Up @@ -12,13 +12,31 @@ For example to use in README's or as webpage static assets.

```sh
# 1. Use the main sourcecred's score feature to export scores to a file.
export SOURCECRED_GITHUB_TOKEN=YOUR_GITHUB_TOKEN
node PATH_TO_SOURCECRED/bin/sourcecred.js load sourcecred/sourcecred
SOURCECRED_GITHUB_TOKEN=YOUR_GITHUB_TOKEN \
node PATH_TO_SOURCECRED/bin/sourcecred.js load sourcecred/sourcecred
Beanow marked this conversation as resolved.
Show resolved Hide resolved
node PATH_TO_SOURCECRED/bin/sourcecred.js scores sourcecred/sourcecred > scores.json

# 2. Install this package's dependencies.
yarn

# 3. Generate a contributor wall SVG.
./bin/contributor-wall-svg.js < scores.json > contributors.svg
SOURCECRED_GITHUB_TOKEN=YOUR_GITHUB_TOKEN \
./bin/contributor-wall-svg.js < scores.json > contributors.svg
```

Or using the Docker equivalent of this.

```sh
# 1. Use the main sourcecred image to export scores to a file.
SOURCECRED_GITHUB_TOKEN=YOUR_GITHUB_TOKEN \
docker run --rm -ti -v sourcecred_data:/data -e SOURCECRED_GITHUB_TOKEN sourcecred/sourcecred load sourcecred/sourcecred
Beanow marked this conversation as resolved.
Show resolved Hide resolved
docker run --rm -ti -v sourcecred_data:/data sourcecred/sourcecred scores sourcecred/sourcecred > scores.json

# 2. To build a Docker image with your changes. Or skip this to use a release from Dockerhub.
docker build -t sourcecred/widgets .

# 3. Generate a contributor wall SVG.
# Note: don't use the -t option here, it will produce an error "the input device is not a TTY".
SOURCECRED_GITHUB_TOKEN=YOUR_GITHUB_TOKEN \
docker run --rm -i -e SOURCECRED_GITHUB_TOKEN sourcecred/widgets < scores.json > contributors.svg
```