Skip to content

Commit

Permalink
[docker] Run as non-root user, fixes permissions. (OpenAPITools#5702)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyfw authored and wing328 committed May 31, 2017
1 parent 34b7423 commit 31a8ac6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pattern="@Command(name = \"$1\""
if expr "x$1" : 'x[a-z][a-z-]*$' > /dev/null && fgrep -qe "$pattern" "$cmdsrc"/*.java; then
# If ${GEN_DIR} has been mapped elsewhere from default, and that location has not been built
if [[ ! -f "${codegen}" ]]; then
(cd "${GEN_DIR}" && exec mvn -am -pl "modules/swagger-codegen-cli" package)
(cd "${GEN_DIR}" && exec mvn -am -pl "modules/swagger-codegen-cli" -Duser.home=$(dirname MAVEN_CONFIG) package)
fi
command=$1
shift
Expand Down
4 changes: 3 additions & 1 deletion run-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ mkdir -p "${maven_cache_repo}"
docker run --rm -it \
-w /gen \
-e GEN_DIR=/gen \
-e MAVEN_CONFIG=/var/maven/.m2 \
-u "$(id -u):$(id -u)" \
-v "${PWD}:/gen" \
-v "${maven_cache_repo}:/root/.m2/repository" \
-v "${maven_cache_repo}:/var/maven/.m2/repository" \
--entrypoint /gen/docker-entrypoint.sh \
maven:3-jdk-7 "$@"

0 comments on commit 31a8ac6

Please sign in to comment.