Skip to content

Commit

Permalink
Merge pull request #17 from JWGmeligMeyling/run-as-user
Browse files Browse the repository at this point in the history
Added property to set docker user
  • Loading branch information
michaeldejong committed Apr 22, 2015
2 parents e6ed44d + 61abc7d commit 8b7e8ad
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
8 changes: 4 additions & 4 deletions build-server/src/main/java/nl/tudelft/ewi/build/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public interface Config {
int getMaximumConcurrentJobs();

String getStagingDirectory();

String getWorkingDirectory();


String getClientId();

String getClientSecret();


String getDockerUser();

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public PropertyBasedConfig() {
this.properties = new Properties();
reload();
}

public void reload() {
try (InputStreamReader reader = new InputStreamReader(getClass().getResourceAsStream("/config.properties"))) {
properties.load(reader);
Expand All @@ -24,29 +24,35 @@ public void reload() {
log.error(e.getMessage());
}
}


@Override
public int getHttpPort() {
return Integer.parseInt(properties.getProperty("http.port", "8080"));
}


@Override
public int getMaximumConcurrentJobs() {
return Integer.parseInt(properties.getProperty("docker.max-containers"));
}


@Override
public String getStagingDirectory() {
return properties.getProperty("docker.staging-directory");
}

public String getWorkingDirectory() {
return properties.getProperty("docker.working-directory");
}


@Override
public String getClientId() {
return properties.getProperty("authorization.client-id");
}


@Override
public String getClientSecret() {
return properties.getProperty("authorization.client-secret");
}


@Override
public String getDockerUser() {
return properties.getProperty("docker.user", "root");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public ContainerExit call() throws Exception {
ContainerConfig.Builder configBuilder = ContainerConfig.builder()
.image(buildInstructionInterpreter.getImage(buildInstruction))
.cmd(buildInstructionInterpreter.getCommand(buildInstruction).split(" "))
.user(config.getDockerUser())
.volumes(volume)
.workingDir(WORK_DIR);

Expand Down
1 change: 1 addition & 0 deletions build-server/src/main/resources/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ authorization.client-secret = t2hLCXVE
docker.max-containers = 3
docker.staging-directory = /workspace
docker.working-directory = /workspace
docker.user = root

http.port = 8082

0 comments on commit 8b7e8ad

Please sign in to comment.