Auto-deploy to DockerHub

This commit is contained in:
Sebastian Wilzbach 2018-06-29 17:16:29 +02:00
parent 83fb251d73
commit 570796ca28
3 changed files with 47 additions and 1 deletions

View File

@ -62,6 +62,24 @@ jobs:
on: on:
repo: dlang-community/D-Scanner repo: dlang-community/D-Scanner
tags: true tags: true
- stage: dockerhub-stable
if: tag IS present
d: ldc
os: linux
script:
- echo "Deploying to DockerHub..." && ./release.sh
- LATEST_TAG="$(git describe --abbrev=0 --tags)"
- docker build -t "dlangcommunity/dscanner:${LATEST_TAG} ."
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" ; fi
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then docker push "dlangcommunity/dscanner:${LATEST_TAG}" ; fi
- stage: dockerhub-latest
d: ldc
os: linux
script:
- echo "Deploying to DockerHub..." && ./release.sh
- docker build -t dlangcommunity/dscanner:latest .
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" ; fi
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then docker push dlangcommunity/dscanner:latest ; fi
stages: stages:
- name: test - name: test
if: type = pull_request or (type = push and branch = master) if: type = pull_request or (type = push and branch = master)

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM busybox
MAINTAINER "DLang Community <community@dlang.io>"
COPY bin/dscanner /dscanner
RUN chmod +x /dscanner
WORKDIR /src
ENTRYPOINT [ "/dscanner" ]

View File

@ -1,4 +1,9 @@
# D-Scanner [![CI status](https://travis-ci.org/dlang-community/D-Scanner.svg?branch=master)](https://travis-ci.org/dlang-community/D-Scanner/) # D-Scanner
[![CI status](https://travis-ci.org/dlang-community/D-Scanner.svg?branch=master)](https://travis-ci.org/dlang-community/D-Scanner/)
[![Latest version](https://img.shields.io/dub/v/dscanner.svg)](http://code.dlang.org/packages/dscanner)
[![License](https://img.shields.io/dub/l/dscanner.svg)](http://code.dlang.org/packages/dscanner)
D-Scanner is a tool for analyzing D source code D-Scanner is a tool for analyzing D source code
### Building and installing ### Building and installing
@ -23,6 +28,14 @@ Under Windows run the tests with `build.bat test`.
> dub fetch dscanner && dub run dscanner > dub fetch dscanner && dub run dscanner
``` ```
## Installing with Docker
With Docker no installation is required:
```sh
docker run --rm -v $(pwd):/src dlangcommunity/dscanner
```
# Usage # Usage
The following examples assume that we are analyzing a simple file called helloworld.d The following examples assume that we are analyzing a simple file called helloworld.d
@ -53,6 +66,11 @@ to resolve the locations of the imported modules.
$ dscanner --imports helloworld.d -I ~/.dvm/compilers/dmd-2.071.1-b2/src/phobos/ -I ~/.dvm/compilers/dmd-2.071.1-b2/src/druntime/src/ $ dscanner --imports helloworld.d -I ~/.dvm/compilers/dmd-2.071.1-b2/src/phobos/ -I ~/.dvm/compilers/dmd-2.071.1-b2/src/druntime/src/
/home/brian/.dvm/compilers/dmd-2.071.1-b2/src/phobos/std/stdio.d /home/brian/.dvm/compilers/dmd-2.071.1-b2/src/phobos/std/stdio.d
Remember to pass map the import locations when you use Docker:
docker run --rm -v $(pwd):/src -v /usr/include/dlang/dmd:/d dlangcommunity/dscanner --imports helloworld.d -I/d
/d/std/stdio.d
The "--recursiveImports" option is similar to "--imports", except that it lists The "--recursiveImports" option is similar to "--imports", except that it lists
imports of imports (and so on) recursively. The recursive import option requires imports of imports (and so on) recursively. The recursive import option requires
import paths to be specified in order to work correctly. import paths to be specified in order to work correctly.