Skip to content

Commit c6b15f5

Browse files
authored
Merge pull request #22 from dlidstrom/docker-image
Small docker image
2 parents 71b077f + 0aec334 commit c6b15f5

File tree

4 files changed

+134
-4
lines changed

4 files changed

+134
-4
lines changed

.github/workflows/ccpp.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,29 @@ jobs:
7272
with:
7373
name: uploads
7474
path: duplo-macos.zip
75+
push-docker-image:
76+
runs-on: ubuntu-latest
77+
needs: [bump-tag-dry]
78+
steps:
79+
- name: download artifacts
80+
uses: actions/download-artifact@v1
81+
with:
82+
name: uploads
83+
- name: set version
84+
run: echo "::set-env name=DUPLO_VERSION::$(cat ./uploads/tag.txt)"
85+
- name: print version
86+
run: echo $DUPLO_VERSION
87+
- uses: actions/checkout@master
88+
with:
89+
fetch-depth: '0'
90+
- uses: docker/build-push-action@v1
91+
with:
92+
username: ${{ secrets.DOCKER_USERNAME }}
93+
password: ${{ secrets.DOCKER_PASSWORD }}
94+
repository: dlidstrom/duplo
95+
tag_with_ref: true
96+
# push: ${{ startsWith(github.ref, 'refs/tags/') }}
97+
build_args: DUPLO_VERSION=${{ env.DUPLO_VERSION }}
7598
upload-release:
7699
if: success() && github.ref == 'refs/heads/master'
77100
runs-on: ubuntu-latest

Docker.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Duplo (C/C++/Java Duplicate Source Code Block Finder)
2+
3+
This project is found in GitHub: [https://github.com/dlidstrom/Duplo](https://github.com/dlidstrom/Duplo).
4+
5+
## General Information
6+
7+
Duplicated source code blocks can harm maintainability of software systems.
8+
Duplo is a tool to find duplicated code blocks in large C, C++, Java, C# and
9+
VB.Net systems.
10+
11+
## Maintainer
12+
13+
Duplo was originally developed by Christian
14+
M. Ammann and is now maintained and developed by Daniel
15+
Lidström.
16+
17+
## Usage
18+
19+
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`.
20+
21+
Run `duplo --help` on the command line to see the detailed options.
22+
23+
### Passing files using `stdin`
24+
25+
```bash
26+
# unix
27+
> find . \( -iname "*.cpp" -o -iname "*.h" \) | docker run dlidstrom/duplo - out.txt
28+
29+
# windows
30+
> Get-ChildItem -Include "*.cpp", "*.h" -Recurse | % { $_.FullName } | docker run dlidstrom/duplo - out.txt
31+
```
32+
33+
`duplo` will write the duplicated blocks into `out.txt`.
34+
35+
### Passing files using file
36+
37+
`duplo` can analyze files specified in a separate file:
38+
39+
```bash
40+
# unix
41+
> find . -type f \( -iname "*.cpp" -o -iname "*.h" \) > files.lst
42+
> docker run dlidstrom/duplo files.lst out.txt
43+
44+
# windows
45+
> Get-ChildItem -Include "*.cpp", "*.h" -Recurse | % { $_.FullName } | Out-File -encoding ascii files.lst
46+
> docker run dlidstrom/duplo.exe files.lst out.txt
47+
```
48+
49+
## Feedback and Bug Reporting
50+
51+
Please open a GitHub issue to discuss feedback,
52+
feature requests and bug reports.
53+
54+
## License
55+
56+
Duplo is free software; you can redistribute it and/or modify
57+
it under the terms of the GNU General Public License as published by
58+
the Free Software Foundation; either version 2 of the License, or
59+
(at your option) any later version.
60+
61+
Duplo is distributed in the hope that it will be useful,
62+
but WITHOUT ANY WARRANTY; without even the implied warranty of
63+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64+
GNU General Public License for more details.
65+
66+
You should have received a copy of the GNU General Public License
67+
along with Duplo; if not, write to the Free Software
68+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
69+
70+
---

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM alpine:3.11 AS build
2+
ARG DUPLO_VERSION=v1.0.0
3+
4+
RUN apk --no-cache add \
5+
alpine-sdk cmake
6+
7+
RUN mkdir -p /usr/src/ && \
8+
git clone https://github.com/dlidstrom/Duplo /usr/src/Duplo
9+
10+
WORKDIR /usr/src/Duplo
11+
12+
RUN mkdir build && \
13+
cd build && \
14+
cmake .. -DDUPLO_VERSION=\"$DUPLO_VERSION\" && \
15+
make
16+
17+
FROM alpine:3.11
18+
19+
RUN apk --no-cache add libstdc++
20+
21+
COPY --from=build /usr/src/Duplo/build/duplo .
22+
23+
ENTRYPOINT ["./duplo"]

README.markdown renamed to README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- [1.2. Maintainer](#12-maintainer)
88
- [1.3. File Format Support](#13-file-format-support)
99
- [1.4. Installation](#14-installation)
10+
- [1.4.1. Docker](#141-docker)
11+
- [1.4.2. Pre-built binaries](#142-pre-built-binaries)
1012
- [1.5. Usage](#15-usage)
1113
- [1.5.1. Passing files using `stdin`](#151-passing-files-using-stdin)
1214
- [1.5.2. Passing files using file](#152-passing-files-using-file)
@@ -20,7 +22,7 @@
2022
- [1.8.3. Additional Language Support](#183-additional-language-support)
2123
- [1.8.4. Language Suggestions](#184-language-suggestions)
2224
- [1.9. Changes](#19-changes)
23-
- [1.10. License](#110-license)
25+
- [1.10. 1.10. License](#110-110-license)
2426

2527
## 1.1. General Information
2628

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

7678
## 1.4. Installation
7779

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

80-
You can of course build from source as well, and you'll currently have to do so for Windows.
82+
If you have Docker, the easiest way to run Duplo is to:
83+
84+
```bash
85+
> docker run dlidstrom/duplo
86+
```
87+
88+
This pulls the latest image and runs duplo. In the usage section below, use this command in place of `duplo` or `Duplo.exe`.
89+
90+
### 1.4.2. Pre-built binaries
91+
92+
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.
93+
94+
You can of course build from source as well, and you'll have to do so to get a binary for Windows.
8195

8296
## 1.5. Usage
8397

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

0 commit comments

Comments
 (0)