Skip to content

Commit 55e91b4

Browse files
docker: revise setup to automatically determine user and group id
1 parent b38de60 commit 55e91b4

6 files changed

Lines changed: 12 additions & 13 deletions

File tree

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ RUN mvn package || exit
1414

1515
FROM openjdk:19-alpine
1616

17+
ARG GROUP_ID
18+
ARG USER_ID
19+
1720
# Create a user
18-
RUN adduser --disabled-password --home /home/user --gecos '' user
21+
RUN addgroup -g $GROUP_ID user
22+
RUN adduser --disabled-password -G user -u $USER_ID --home /home/user --gecos '' user
1923

2024
# Prepare the environment
2125
RUN apk update
@@ -69,6 +73,4 @@ RUN chmod +x entrypoint.sh
6973
RUN chmod +x fix-perms.sh
7074
RUN chmod +x extract.sh
7175

72-
ENTRYPOINT ["./entrypoint.sh", "./extract.sh"]
73-
# calculon user
74-
USER 1015
76+
ENTRYPOINT ["./entrypoint.sh", "./extract.sh"]

build-docker-image.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
docker build -t extraction .
1+
docker build --build-arg USER_ID=1000 --build-arg GROUP_ID=1000 -t extraction .
22
@pause

build-docker-image.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#! /bin/bash
2-
docker build -t extraction .
2+
docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t extraction .
3+

docker-resources/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
if [ "$(id -u)" = "0" ]; then
33
# running on a developer laptop as root
44
ls -l
5+
echo "adjusting permissions for user"
56
./fix-perms.sh -r -u user -g user /home/user
67
exec gosu user "$@"
78
else

docker-resources/verification.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
Project name | Domain | Source code available (**y**es/**n**o)? | Is it a git repository (**y**es/**n**o)? | Repository URL | Clone URL | Estimated number of commits
22
-------------------|-------------------------|-----------------------------------------|------------------------------------------|--------------------------------------------------------------|----------------------------------------------------|-----------------------------
33
busybox | embedded systems | y | y | https://git.busybox.net/busybox | https://github.com/DiffDetective/busybox | 17,447
4-
lynx | web browser | y | y | https://github.com/lynx/lynx | https://github.com/DiffDetective/lynx.git | 125
5-
sendmail | mail transfer agent | y | y | https://github.com/guileen/node-sendmail | https://github.com/DiffDetective/node-sendmail.git | 86
6-
xfig | vector graphics editor | y | y | https://github.com/hhoeflin/xfig | https://github.com/DiffDetective/xfig.git | 9
7-
xine-lib | media library | y | y | https://github.com/rpmfusion/xine-lib | https://github.com/DiffDetective/xine-lib.git | 114
8-
xterm | terminal emulator | y | y | https://github.com/Maximus5/xterm | https://github.com/DiffDetective/xterm.git | 112

docker-resources/verification.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ extraction.extract-code-matching=false
1313
# Path in which diff detective keeps its intermediate results. No need to change this.
1414
diff-detective.output-dir=ground-truth/dd
1515
# Path in which diff detective keeps the repos. No need to change this.
16-
diff-detective.repo-storage-dir=DiffDetectiveMining
16+
diff-detective.repo-storage-dir=ground-truth/REPOS
1717
# Path to which the ground truth is saved. Do NOT change this without knowing how this affects the Docker file system interface
1818
extraction.gt-save-dir=ground-truth
1919
# Number of commits to process in a single batch by one thread
20-
diff-detective.batch-size=64
20+
diff-detective.batch-size=8

0 commit comments

Comments
 (0)