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

initial proof-of-concept in a container #11

Open
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
vendor
.git
*.pyc
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:2.7-alpine
MAINTAINER [email protected]
WORKDIR /app

# add LTS version of nodejs
RUN apk --no-cache add nodejs

# install nodejs packages
COPY package.json .
RUN npm install

# install python packages
COPY requirements.txt .
RUN pip2 install --no-cache-dir --target=vendor/py2 -r requirements.txt

COPY . .
CMD [ "/app/runlint.py", "/src", "-v" ]
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
image:
docker build -t khanacademy/khan-linter .

deploy: image
docker push khanacademy/khan-linter

deps vendor_deps: check_setup
rm -r vendor/py2/* || true
rm -r vendor/py3/* || true
Expand All @@ -8,8 +14,6 @@ deps vendor_deps: check_setup
npm prune
echo "DONE. Consider running: git add -A vendor node_modules"



check_setup:
@command -v npm > /dev/null || echo "missing dependencies: need to install npm"
@command -v pip2 > /dev/null || echo "missing dependencies: need to install pip2"
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ you can specify files on the command line to lint. See

for more options.

via Docker image
----------------
A built image with all pre-requesites is available on Docker Hub as `khanacademy/khan-linter`.

Mount the directory you wish to lint as a volume (by default, the image CMD is configured to look in `/src` if nothing else is specified).

For example, to lint the current directory:

docker run -it --rm -v $(pwd):/src khanacademy/khan-linter

If the image is not already on the local environment, it will automatically be downloaded prior to execution.

Automatic
---------
You can update the blacklist file in this repository to control what files
Expand Down