Add Dockerfile (#4687)
* added docker image * added breakdown example to README.md, removed useless packages from docker, fix .dockerignore * delete useless libs after build * remove cmake after build * Add test for dockerfile * Checkout code Co-authored-by: Zaytsev Dmitriy <zaytsev_dmitriy@edadeal.ru> Co-authored-by: Colin Seymour <colin@github.com>
This commit is contained in:
Родитель
61fc3f06a3
Коммит
8083cb5a89
|
@ -0,0 +1,2 @@
|
|||
.git/
|
||||
test/
|
|
@ -27,3 +27,16 @@ jobs:
|
|||
run: bundle exec rake
|
||||
- name: Check Licenses
|
||||
run: bundle exec licensed status -c vendor/licenses/config.yml
|
||||
dockerfile:
|
||||
name: Test Dockerfile
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Build container
|
||||
run: docker build -t linguist .
|
||||
- name: Analyse current directory
|
||||
run: docker run --rm -v $(pwd):$(pwd) -w $(pwd) -t linguist > output
|
||||
- name: Confirm analysis
|
||||
run: |
|
||||
cat output
|
||||
grep Ruby output
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
FROM ruby:alpine
|
||||
|
||||
RUN apk --update add --virtual build_deps \
|
||||
build-base \
|
||||
libc-dev \
|
||||
linux-headers \
|
||||
cmake \
|
||||
&& apk --no-cache add icu-dev libressl-dev \
|
||||
&& gem install github-linguist \
|
||||
&& apk del build_deps build-base libc-dev linux-headers cmake
|
||||
|
||||
CMD ["github-linguist"]
|
30
README.md
30
README.md
|
@ -137,6 +137,36 @@ grammars.yml: 884 lines (884 sloc)
|
|||
language: YAML
|
||||
```
|
||||
|
||||
#### Docker
|
||||
|
||||
If you have Docker installed you can build an image and run Linguist within a container:
|
||||
|
||||
```console
|
||||
$ docker build -t linguist .
|
||||
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) -t linguist
|
||||
68.57% Ruby
|
||||
22.90% C
|
||||
6.93% Go
|
||||
1.21% Lex
|
||||
0.39% Shell
|
||||
$ docker run --rm -v $(pwd):$(pwd) -w $(pwd) -t linguist github-linguist --breakdown
|
||||
68.57% Ruby
|
||||
22.90% C
|
||||
6.93% Go
|
||||
1.21% Lex
|
||||
0.39% Shell
|
||||
|
||||
Ruby:
|
||||
Gemfile
|
||||
Rakefile
|
||||
bin/git-linguist
|
||||
bin/github-linguist
|
||||
ext/linguist/extconf.rb
|
||||
github-linguist.gemspec
|
||||
lib/linguist.rb
|
||||
…
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### My repository is detected as the wrong language
|
||||
|
|
Загрузка…
Ссылка в новой задаче