Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proxy support for launch sh #1102

Open
wants to merge 3 commits into
base: v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ services:
args:
- https_proxy
- http_proxy
- no_proxy
command: mvn -v
environment:
KNOWLEDGE_TEST_MAIL: 'false'
MAVEN_CONFIG: /var/maven/.m2
https_proxy: ${https_proxy}
http_proxy: ${http_proxy}
no_proxy: ${no_proxy}
working_dir: /usr/src/mymaven/
entrypoint: ''
volumes:
Expand All @@ -35,6 +37,7 @@ services:
environment:
https_proxy: ${https_proxy}
http_proxy: ${http_proxy}
no_proxy: ${no_proxy}
volumes:
- ${KNOWLEDGE_HOME}.knowledge:/root/.knowledge
- $PWD/target/webapps:/usr/local/tomcat/webapps
Expand Down
28 changes: 23 additions & 5 deletions launch.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
#!/bin/bash -eu

docker-compose run --rm maven mvn install -DskipTests=true -Dmaven.javadoc.skip=true -e
# docker-compose run --rm maven mvn clean test site -e
docker-compose run --rm maven mvn clean package -e
propagate_proxy_vars () {
# For newer JVM versions, use this instead.
# echo " -Djava.net.useSystemProxies=true"

mkdir target/webapps
mv target/knowledge.war target/webapps/ROOT.war
if test -n "$https_proxy"; then
echo " -Dhttps.proxyHost=$(echo $https_proxy | sed 's|.*://||; s|:.*||')"
echo " -Dhttps.proxyPort=$(echo $https_proxy | sed 's|.*:||')"
fi
if test -n "$http_proxy"; then
echo " -Dhttp.proxyHost=$(echo $http_proxy | sed 's|.*://||; s|:.*||')"
echo " -Dhttp.proxyPort=$(echo $http_proxy | sed 's|.*:||')"
fi
if test -n "$no_proxy"; then
echo " -Dhttp.nonProxyHosts=$(echo $no_proxy | sed 's/,\./,*./g; s/,/|/g')"
fi
}

docker-compose run --rm maven mvn install -DskipTests=true -Dmaven.javadoc.skip=true -e $(propagate_proxy_vars)
# docker-compose run --rm maven mvn clean test site -e $(propagate_proxy_vars)
docker-compose run --rm maven mvn clean package -e $(propagate_proxy_vars)

# Run everything through docker-compose to work around permission issues.
docker-compose run --rm maven mkdir target/webapps
docker-compose run --rm maven mv target/knowledge.war target/webapps/ROOT.war

docker-compose up --build -d tomcat
docker-compose logs -f tomcat