From e06f69f3c12de915a2adee9c3a6fbc18d815ae90 Mon Sep 17 00:00:00 2001 From: rsercano Date: Fri, 17 Mar 2017 15:15:45 +0100 Subject: [PATCH] trying to use debian for openshift --- .docker/build-meteor.sh | 4 ++-- .docker/entrypoint.sh | 9 +++++---- .docker/install-deps.sh | 4 ++-- .docker/install-meteor.sh | 2 +- .docker/install-mongo.sh | 9 ++++++--- .docker/install-node.sh | 2 +- Dockerfile | 5 ++--- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.docker/build-meteor.sh b/.docker/build-meteor.sh index c285dc1..74bcc72 100644 --- a/.docker/build-meteor.sh +++ b/.docker/build-meteor.sh @@ -19,7 +19,7 @@ meteor npm install # build the bundle printf "\n[-] Building Meteor application...\n\n" mkdir -p $APP_BUNDLE_DIR -meteor build --directory $APP_BUNDLE_DIR > /dev/null +meteor build --directory $APP_BUNDLE_DIR # run npm install in bundle printf "\n[-] Running npm install in the server bundle...\n\n" @@ -30,4 +30,4 @@ meteor npm install --production mv $BUILD_SCRIPTS_DIR/entrypoint.sh $APP_BUNDLE_DIR/bundle/entrypoint.sh # change ownership of the app to the node user -chown -R node:node $APP_BUNDLE_DIR +chown -R node:node $APP_BUNDLE_DIR \ No newline at end of file diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh index 43cdcce..73b6998 100644 --- a/.docker/entrypoint.sh +++ b/.docker/entrypoint.sh @@ -5,11 +5,12 @@ set -e # try to start local MongoDB if no external MONGO_URL was set if [[ "${MONGO_URL}" == *"127.0.0.1"* ]]; then if hash mongod 2>/dev/null; then - mkdir -p /data/{db,configdb} printf "\n[-] External MONGO_URL not found. Starting local MongoDB...\n\n" - mongod --storageEngine=wiredTiger & + chown -R mongodb:mongodb /data/{db,configdb} + exec gosu mongodb mongod --storageEngine=wiredTiger > /dev/null 2>&1 & else - echo "ERROR: Mongo not installed inside the container, try to set MONGO_URL env variable" + echo "ERROR: Mongo not installed inside the container." + echo "Please supply a MONGO_URL environment variable." exit 1 fi fi @@ -38,4 +39,4 @@ fi # Start app echo "=> Starting app on port $PORT..." -exec "$@" +exec "$@" \ No newline at end of file diff --git a/.docker/install-deps.sh b/.docker/install-deps.sh index c464317..5fc18a0 100644 --- a/.docker/install-deps.sh +++ b/.docker/install-deps.sh @@ -6,7 +6,7 @@ printf "\n[-] Installing base OS dependencies...\n\n" apt-get update -y -apt-get install -y --no-install-recommends curl ca-certificates bzip2 build-essential numactl python git wget libc6 +apt-get install -y --no-install-recommends curl ca-certificates bzip2 build-essential numactl python git wget dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" @@ -24,4 +24,4 @@ chmod +x /usr/local/bin/gosu gosu nobody true -apt-get purge -y --auto-remove wget +apt-get purge -y --auto-remove wget \ No newline at end of file diff --git a/.docker/install-meteor.sh b/.docker/install-meteor.sh index 521d98d..3ed71dc 100644 --- a/.docker/install-meteor.sh +++ b/.docker/install-meteor.sh @@ -20,4 +20,4 @@ else # install printf "\n[-] Installing Meteor $METEOR_VERSION...\n\n" sh /tmp/install_meteor.sh -fi +fi \ No newline at end of file diff --git a/.docker/install-mongo.sh b/.docker/install-mongo.sh index 57c3a94..c102542 100644 --- a/.docker/install-mongo.sh +++ b/.docker/install-mongo.sh @@ -4,9 +4,9 @@ set -e printf "\n[-] Installing MongoDB ${MONGO_VERSION}...\n\n" - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv BC711F9BA15703C6 + apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6 - echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/$MONGO_MAJOR multiverse" | tee /etc/apt/sources.list.d/mongodb-org.list + echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list apt-get update @@ -17,6 +17,9 @@ set -e ${MONGO_PACKAGE}-mongos=$MONGO_VERSION \ ${MONGO_PACKAGE}-tools=$MONGO_VERSION + mkdir -p /data/{db,configdb} + chown -R mongodb:mongodb /data/{db,configdb} + rm -rf /var/lib/apt/lists/* rm -rf /var/lib/mongodb - mv /etc/mongod.conf /etc/mongod.conf.orig + mv /etc/mongod.conf /etc/mongod.conf.orig \ No newline at end of file diff --git a/.docker/install-node.sh b/.docker/install-node.sh index 9db8d97..85cdd8e 100644 --- a/.docker/install-node.sh +++ b/.docker/install-node.sh @@ -14,4 +14,4 @@ rm -rf /opt/nodejs mv ${NODE_DIST} /opt/nodejs ln -sf /opt/nodejs/bin/node /usr/bin/node -ln -sf /opt/nodejs/bin/npm /usr/bin/npm +ln -sf /opt/nodejs/bin/npm /usr/bin/npm \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 48f4c82..a23f9e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM debian:jessie MAINTAINER R.Sercan Ă–zdemir RUN groupadd -r node && useradd -m -g node node @@ -7,7 +7,7 @@ ENV NODE_VERSION 4.7.3 ENV GOSU_VERSION 1.10 # install MongoDB -ENV MONGO_VERSION 3.4.0 +ENV MONGO_VERSION 3.4.2 ENV MONGO_MAJOR 3.4 ENV MONGO_PACKAGE mongodb-org @@ -34,7 +34,6 @@ RUN cd $BUILD_SCRIPTS_DIR && \ # copy the app to the container COPY . $APP_SOURCE_DIR -RUN chmod -R 770 $BUILD_SCRIPTS_DIR # install Meteor, build app, clean up RUN cd $APP_SOURCE_DIR && \ -- GitLab