* 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:
Zaytsev Dmitriy 2020-09-08 11:54:02 +03:00 коммит произвёл GitHub
Родитель 61fc3f06a3
Коммит 8083cb5a89
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 57 добавлений и 0 удалений

2
.dockerignore Normal file
Просмотреть файл

@ -0,0 +1,2 @@
.git/
test/

13
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -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

12
Dockerfile Normal file
Просмотреть файл

@ -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"]

Просмотреть файл

@ -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