Skip to content

Commit

Permalink
Merge pull request #104 from MohamedSabthar/main
Browse files Browse the repository at this point in the history
Update docker command to inherit file permission of host
  • Loading branch information
MohamedSabthar authored Oct 5, 2023
2 parents e26e831 + 167f61c commit 7de17b3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,13 @@ class BallerinaPlugin implements Plugin<Project> {
ballerinaDockerTag = dockerTag
}
def balPackWithDocker = """
docker run --rm --net=host --user ballerina:\$(id -g) \
docker run --rm --net=host --user \$(id -u):\$(id -g) \
-v $parentDirectory:/home/ballerina/$parentDirectory.name \
-v $projectDirectory:/home/ballerina/$parentDirectory.name/$projectDirectory.name \
-w /home/ballerina/$parentDirectory.name/$projectDirectory.name \
ballerina/ballerina:$ballerinaDockerTag $balJavaDebugParam \
bal pack --target-dir ${balBuildTarget} ${debugParams}
-w /home/ballerina \
ballerina/ballerina:$ballerinaDockerTag \
/bin/sh -c "cd $parentDirectory.name/$projectDirectory.name" && \
$balJavaDebugParam bal pack --target-dir ${balBuildTarget} ${debugParams}
"""
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$balPackWithDocker"
Expand All @@ -329,11 +330,12 @@ class BallerinaPlugin implements Plugin<Project> {
ballerinaDockerTag = dockerTag
}
def balTestWithDocker = """
docker run --rm --net=host --user ballerina:\$(id -g) \
docker run --rm --net=host --user \$(id -u):\$(id -g) \
-v $parentDirectory:/home/ballerina/$parentDirectory.name \
-v $projectDirectory:/home/ballerina/$parentDirectory.name/$projectDirectory.name \
-w /home/ballerina/$parentDirectory.name/$projectDirectory.name \
-w /home/ballerina \
ballerina/ballerina:$ballerinaDockerTag \
/bin/sh -c "cd $parentDirectory.name/$projectDirectory.name" && \
bal test ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}
"""
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
Expand Down Expand Up @@ -412,11 +414,12 @@ class BallerinaPlugin implements Plugin<Project> {
workingDir project.projectDir
environment 'JAVA_OPTS', '-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true'
def balTestWithDocker = """
docker run --rm --net=host --user ballerina:\$(id -g) \
docker run --rm --net=host --user \$(id -u):\$(id -g) \
-v $parentDirectory:/home/ballerina/$parentDirectory.name \
-v $projectDirectory:/home/ballerina/$parentDirectory.name/$projectDirectory.name \
-w /home/ballerina/$parentDirectory.name/$projectDirectory.name \
-w /home/ballerina \
ballerina/ballerina:$ballerinaDockerTag \
/bin/sh -c "cd $parentDirectory.name/$projectDirectory.name" && \
bal test ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}
"""
if (buildOnDocker) {
Expand Down

0 comments on commit 7de17b3

Please sign in to comment.