Skip to content

Commit

Permalink
Merge pull request #22 from dlidstrom/docker-image
Browse files Browse the repository at this point in the history
Small docker image
  • Loading branch information
dlidstrom authored May 29, 2020
2 parents 71b077f + 0aec334 commit c6b15f5
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,29 @@ jobs:
with:
name: uploads
path: duplo-macos.zip
push-docker-image:
runs-on: ubuntu-latest
needs: [bump-tag-dry]
steps:
- name: download artifacts
uses: actions/download-artifact@v1
with:
name: uploads
- name: set version
run: echo "::set-env name=DUPLO_VERSION::$(cat ./uploads/tag.txt)"
- name: print version
run: echo $DUPLO_VERSION
- uses: actions/checkout@master
with:
fetch-depth: '0'
- uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: dlidstrom/duplo
tag_with_ref: true
# push: ${{ startsWith(github.ref, 'refs/tags/') }}
build_args: DUPLO_VERSION=${{ env.DUPLO_VERSION }}
upload-release:
if: success() && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
Expand Down
70 changes: 70 additions & 0 deletions Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Duplo (C/C++/Java Duplicate Source Code Block Finder)

This project is found in GitHub: [https://github.com/dlidstrom/Duplo](https://github.com/dlidstrom/Duplo).

## General Information

Duplicated source code blocks can harm maintainability of software systems.
Duplo is a tool to find duplicated code blocks in large C, C++, Java, C# and
VB.Net systems.

## Maintainer

Duplo was originally developed by Christian
M. Ammann and is now maintained and developed by Daniel
Lidström.

## Usage

Duplo works with a list of files. You can either specify a file that contains the list of files, or you can pass them using `stdin`.

Run `duplo --help` on the command line to see the detailed options.

### Passing files using `stdin`

```bash
# unix
> find . \( -iname "*.cpp" -o -iname "*.h" \) | docker run dlidstrom/duplo - out.txt

# windows
> Get-ChildItem -Include "*.cpp", "*.h" -Recurse | % { $_.FullName } | docker run dlidstrom/duplo - out.txt
```
`duplo` will write the duplicated blocks into `out.txt`.
### Passing files using file
`duplo` can analyze files specified in a separate file:
```bash
# unix
> find . -type f \( -iname "*.cpp" -o -iname "*.h" \) > files.lst
> docker run dlidstrom/duplo files.lst out.txt

# windows
> Get-ChildItem -Include "*.cpp", "*.h" -Recurse | % { $_.FullName } | Out-File -encoding ascii files.lst
> docker run dlidstrom/duplo.exe files.lst out.txt
```
## Feedback and Bug Reporting
Please open a GitHub issue to discuss feedback,
feature requests and bug reports.
## License
Duplo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Duplo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Duplo; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
---
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine:3.11 AS build
ARG DUPLO_VERSION=v1.0.0

RUN apk --no-cache add \
alpine-sdk cmake

RUN mkdir -p /usr/src/ && \
git clone https://github.com/dlidstrom/Duplo /usr/src/Duplo

WORKDIR /usr/src/Duplo

RUN mkdir build && \
cd build && \
cmake .. -DDUPLO_VERSION=\"$DUPLO_VERSION\" && \
make

FROM alpine:3.11

RUN apk --no-cache add libstdc++

COPY --from=build /usr/src/Duplo/build/duplo .

ENTRYPOINT ["./duplo"]
22 changes: 18 additions & 4 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- [1.2. Maintainer](#12-maintainer)
- [1.3. File Format Support](#13-file-format-support)
- [1.4. Installation](#14-installation)
- [1.4.1. Docker](#141-docker)
- [1.4.2. Pre-built binaries](#142-pre-built-binaries)
- [1.5. Usage](#15-usage)
- [1.5.1. Passing files using `stdin`](#151-passing-files-using-stdin)
- [1.5.2. Passing files using file](#152-passing-files-using-file)
Expand All @@ -20,7 +22,7 @@
- [1.8.3. Additional Language Support](#183-additional-language-support)
- [1.8.4. Language Suggestions](#184-language-suggestions)
- [1.9. Changes](#19-changes)
- [1.10. License](#110-license)
- [1.10. 1.10. License](#110-110-license)

## 1.1. General Information

Expand Down Expand Up @@ -75,9 +77,21 @@ src\engine\geometry\SkinnedMeshGeometry.cpp(45)

## 1.4. Installation

Duplo is currently available prebuilt for linux and macos. Grab the executable from the [releases](https://github.com/dlidstrom/Duplo/releases) page.
### 1.4.1. Docker

You can of course build from source as well, and you'll currently have to do so for Windows.
If you have Docker, the easiest way to run Duplo is to:

```bash
> docker run dlidstrom/duplo
```

This pulls the latest image and runs duplo. In the usage section below, use this command in place of `duplo` or `Duplo.exe`.

### 1.4.2. Pre-built binaries

Duplo is also available as a pre-built binary for (alpine) linux and macos. Grab the executable from the [releases](https://github.com/dlidstrom/Duplo/releases) page.

You can of course build from source as well, and you'll have to do so to get a binary for Windows.

## 1.5. Usage

Expand Down Expand Up @@ -202,7 +216,7 @@ Send me a pull request!
- Fixed limitation of total number of lines of code
- Checking of arbitrary files
## 1.10. License
## 1.10. 1.10. License
Duplo is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit c6b15f5

Please sign in to comment.