Skip to content

Commit

Permalink
try to fix dockerhub build
Browse files Browse the repository at this point in the history
  • Loading branch information
ruromero committed Jan 16, 2018
1 parent 4ff51a6 commit 42bf4d0
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 5 deletions.
11 changes: 6 additions & 5 deletions images/manager-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ USER root

RUN tar -xf $APP_ROOT/etc/$OC_TOOL.tar.gz -C $APP_ROOT/etc && \
mv $APP_ROOT/etc/$OC_TOOL $APP_ROOT/etc/oc-tool && \
git clone https://github.com/ruromero/devconf /tmp/src/devconf && \
cp -r /tmp/src/devconf/manager-app/. /tmp/src/ && \
rm -rf /tmp/src/devconf && \
chown -R 1001 /tmp/src
git clone https://github.com/ruromero/devconf devconf && \
chown 1001 -R devconf && \
cp -r devconf/manager-app/. . && \
rm -rf devconf

USER 1001

RUN $STI_SCRIPTS_PATH/assemble
ADD assemble.sh $HOME/
RUN $HOME/assemble.sh

CMD $STI_SCRIPTS_PATH/run
61 changes: 61 additions & 0 deletions images/manager-app/assemble.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

# Prevent running assemble in builders different than official STI image.
# The official nodejs:6-onbuild already run npm install and use different
# application folder.
[ -d "/usr/src/app" ] && exit 0

set -e

# FIXME: Linking of global modules is disabled for now as it causes npm failures
# under RHEL7
# Global modules good to have
# npmgl=$(grep "^\s*[^#\s]" ../etc/npm_global_module_list | sort -u)
# Available global modules; only match top-level npm packages
#global_modules=$(npm ls -g 2> /dev/null | perl -ne 'print "$1\n" if /^\S+\s(\S+)\@[\d\.-]+/' | sort -u)
# List all modules in common
#module_list=$(/usr/bin/comm -12 <(echo "${global_modules}") | tr '\n' ' ')
# Link the modules
#npm link $module_list

safeLogging () {
if [[ $1 =~ http[s]?://.*@.*$ ]]; then
echo $1 | sed 's/^.*@/redacted@/'
else
echo $1
fi
}

shopt -s dotglob
echo "---> Installing application source ..."

if [ ! -z $HTTP_PROXY ]; then
echo "---> Setting npm http proxy to" $(safeLogging $HTTP_PROXY)
npm config set proxy $HTTP_PROXY
fi

if [ ! -z $http_proxy ]; then
echo "---> Setting npm http proxy to" $(safeLogging $http_proxy)
npm config set proxy $http_proxy
fi

if [ ! -z $HTTPS_PROXY ]; then
echo "---> Setting npm https proxy to" $(safeLogging $HTTPS_PROXY)
npm config set https-proxy $HTTPS_PROXY
fi

if [ ! -z $https_proxy ]; then
echo "---> Setting npm https proxy to" $(safeLogging $https_proxy)
npm config set https-proxy $https_proxy
fi

# Change the npm registry mirror if provided
if [ -n "$NPM_MIRROR" ]; then
npm config set registry $NPM_MIRROR
fi

echo "---> Building your Node application from source"
npm install

# Fix source directory permissions
fix-permissions ./

0 comments on commit 42bf4d0

Please sign in to comment.