From e7166606ce3a762f7dbbe0963d0b1a1e189b29b2 Mon Sep 17 00:00:00 2001 From: Michele Margoni Date: Wed, 14 Mar 2018 11:50:49 +0100 Subject: [PATCH 1/2] splitting Docker image in two for having SO part already built --- HISTORY.md | 0 LICENSE.md | 0 README.md | 0 {.circleci => base/.circleci}/build.sh | 0 {.circleci => base/.circleci}/config.yml | 0 {.circleci => base/.circleci}/deploy.sh | 0 .dockerignore => base/.dockerignore | 0 base/Dockerfile | 39 +++++++++++++++++ build.sh => base/build.sh | 0 deploy.sh => base/deploy.sh | 0 dev.dockerfile => base/dev.dockerfile | 0 {scripts => base/scripts}/build-meteor.sh | 0 {scripts => base/scripts}/entrypoint.sh | 0 base/scripts/install-deps-opt.sh | 17 ++++++++ {scripts => base/scripts}/install-deps.sh | 18 ++++---- .../scripts}/install-graphicsmagick.sh | 0 {scripts => base/scripts}/install-meteor.sh | 0 {scripts => base/scripts}/install-mongo.sh | 0 {scripts => base/scripts}/install-node.sh | 0 {scripts => base/scripts}/install-phantom.sh | 0 .../scripts}/post-build-cleanup.sh | 0 .../scripts}/post-install-cleanup.sh | 0 Dockerfile => onbuild/Dockerfile | 43 ++----------------- 23 files changed, 69 insertions(+), 48 deletions(-) mode change 100644 => 100755 HISTORY.md mode change 100644 => 100755 LICENSE.md mode change 100644 => 100755 README.md rename {.circleci => base/.circleci}/build.sh (100%) rename {.circleci => base/.circleci}/config.yml (100%) mode change 100644 => 100755 rename {.circleci => base/.circleci}/deploy.sh (100%) rename .dockerignore => base/.dockerignore (100%) mode change 100644 => 100755 create mode 100755 base/Dockerfile rename build.sh => base/build.sh (100%) rename deploy.sh => base/deploy.sh (100%) rename dev.dockerfile => base/dev.dockerfile (100%) mode change 100644 => 100755 rename {scripts => base/scripts}/build-meteor.sh (100%) rename {scripts => base/scripts}/entrypoint.sh (100%) create mode 100644 base/scripts/install-deps-opt.sh rename {scripts => base/scripts}/install-deps.sh (78%) rename {scripts => base/scripts}/install-graphicsmagick.sh (100%) rename {scripts => base/scripts}/install-meteor.sh (100%) rename {scripts => base/scripts}/install-mongo.sh (100%) rename {scripts => base/scripts}/install-node.sh (100%) rename {scripts => base/scripts}/install-phantom.sh (100%) rename {scripts => base/scripts}/post-build-cleanup.sh (100%) rename {scripts => base/scripts}/post-install-cleanup.sh (100%) rename Dockerfile => onbuild/Dockerfile (58%) diff --git a/HISTORY.md b/HISTORY.md old mode 100644 new mode 100755 diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/.circleci/build.sh b/base/.circleci/build.sh similarity index 100% rename from .circleci/build.sh rename to base/.circleci/build.sh diff --git a/.circleci/config.yml b/base/.circleci/config.yml old mode 100644 new mode 100755 similarity index 100% rename from .circleci/config.yml rename to base/.circleci/config.yml diff --git a/.circleci/deploy.sh b/base/.circleci/deploy.sh similarity index 100% rename from .circleci/deploy.sh rename to base/.circleci/deploy.sh diff --git a/.dockerignore b/base/.dockerignore old mode 100644 new mode 100755 similarity index 100% rename from .dockerignore rename to base/.dockerignore diff --git a/base/Dockerfile b/base/Dockerfile new file mode 100755 index 0000000..179c01a --- /dev/null +++ b/base/Dockerfile @@ -0,0 +1,39 @@ +FROM debian:jessie +MAINTAINER OpenMove team + +RUN groupadd -r node && useradd -m -g node node + +# Gosu +ENV GOSU_VERSION 1.10 + +# MongoDB +ENV MONGO_VERSION 3.4.10 +ENV MONGO_MAJOR 3.4 +ENV MONGO_PACKAGE mongodb-org + +# PhantomJS +ENV PHANTOM_VERSION 2.1.1 + +# build directories +ENV APP_SOURCE_DIR /opt/meteor/src +ENV APP_BUNDLE_DIR /opt/meteor/dist +ENV BUILD_SCRIPTS_DIR /opt/build_scripts + +# Add entrypoint and build scripts +COPY scripts $BUILD_SCRIPTS_DIR +RUN chmod -R 750 $BUILD_SCRIPTS_DIR + +RUN $BUILD_SCRIPTS_DIR/install-deps.sh + +# Default values for Meteor environment variables +ENV ROOT_URL http://localhost +ENV MONGO_URL mongodb://127.0.0.1:27017/meteor +ENV PORT 3000 + +# EXPOSE 80 + +WORKDIR $APP_BUNDLE_DIR/bundle + +# start the app +ENTRYPOINT ["./entrypoint.sh"] +CMD ["node", "main.js"] diff --git a/build.sh b/base/build.sh similarity index 100% rename from build.sh rename to base/build.sh diff --git a/deploy.sh b/base/deploy.sh similarity index 100% rename from deploy.sh rename to base/deploy.sh diff --git a/dev.dockerfile b/base/dev.dockerfile old mode 100644 new mode 100755 similarity index 100% rename from dev.dockerfile rename to base/dev.dockerfile diff --git a/scripts/build-meteor.sh b/base/scripts/build-meteor.sh similarity index 100% rename from scripts/build-meteor.sh rename to base/scripts/build-meteor.sh diff --git a/scripts/entrypoint.sh b/base/scripts/entrypoint.sh similarity index 100% rename from scripts/entrypoint.sh rename to base/scripts/entrypoint.sh diff --git a/base/scripts/install-deps-opt.sh b/base/scripts/install-deps-opt.sh new file mode 100644 index 0000000..f35871b --- /dev/null +++ b/base/scripts/install-deps-opt.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +printf "\n[-] Installing OPTIONAL dependencies...\n\n" + +# install optional dependencies + +if [ -f $APP_SOURCE_DIR/launchpad.conf ]; then + source <(grep APT_GET_INSTALL $APP_SOURCE_DIR/launchpad.conf) + + if [ "$APT_GET_INSTALL" ]; then + printf "\n[-] Installing custom apt dependencies...\n\n" + apt-get update + apt-get install -y $APT_GET_INSTALL + fi +fi diff --git a/scripts/install-deps.sh b/base/scripts/install-deps.sh similarity index 78% rename from scripts/install-deps.sh rename to base/scripts/install-deps.sh index ef10605..7b2df51 100755 --- a/scripts/install-deps.sh +++ b/base/scripts/install-deps.sh @@ -11,15 +11,15 @@ apt-get update # ensure we can get an https apt source if redirected # https://github.com/jshimko/meteor-launchpad/issues/50 apt-get install -y apt-transport-https ca-certificates - -if [ -f $APP_SOURCE_DIR/launchpad.conf ]; then - source <(grep APT_GET_INSTALL $APP_SOURCE_DIR/launchpad.conf) - - if [ "$APT_GET_INSTALL" ]; then - printf "\n[-] Installing custom apt dependencies...\n\n" - apt-get install -y $APT_GET_INSTALL - fi -fi +# +# if [ -f $APP_SOURCE_DIR/launchpad.conf ]; then +# source <(grep APT_GET_INSTALL $APP_SOURCE_DIR/launchpad.conf) +# +# if [ "$APT_GET_INSTALL" ]; then +# printf "\n[-] Installing custom apt dependencies...\n\n" +# apt-get install -y $APT_GET_INSTALL +# fi +# fi apt-get install -y --no-install-recommends curl bzip2 bsdtar build-essential python git wget diff --git a/scripts/install-graphicsmagick.sh b/base/scripts/install-graphicsmagick.sh similarity index 100% rename from scripts/install-graphicsmagick.sh rename to base/scripts/install-graphicsmagick.sh diff --git a/scripts/install-meteor.sh b/base/scripts/install-meteor.sh similarity index 100% rename from scripts/install-meteor.sh rename to base/scripts/install-meteor.sh diff --git a/scripts/install-mongo.sh b/base/scripts/install-mongo.sh similarity index 100% rename from scripts/install-mongo.sh rename to base/scripts/install-mongo.sh diff --git a/scripts/install-node.sh b/base/scripts/install-node.sh similarity index 100% rename from scripts/install-node.sh rename to base/scripts/install-node.sh diff --git a/scripts/install-phantom.sh b/base/scripts/install-phantom.sh similarity index 100% rename from scripts/install-phantom.sh rename to base/scripts/install-phantom.sh diff --git a/scripts/post-build-cleanup.sh b/base/scripts/post-build-cleanup.sh similarity index 100% rename from scripts/post-build-cleanup.sh rename to base/scripts/post-build-cleanup.sh diff --git a/scripts/post-install-cleanup.sh b/base/scripts/post-install-cleanup.sh similarity index 100% rename from scripts/post-install-cleanup.sh rename to base/scripts/post-install-cleanup.sh diff --git a/Dockerfile b/onbuild/Dockerfile similarity index 58% rename from Dockerfile rename to onbuild/Dockerfile index 3e7f1c4..cfc035e 100644 --- a/Dockerfile +++ b/onbuild/Dockerfile @@ -1,27 +1,5 @@ -FROM debian:jessie -MAINTAINER Jeremy Shimko - -RUN groupadd -r node && useradd -m -g node node - -# Gosu -ENV GOSU_VERSION 1.10 - -# MongoDB -ENV MONGO_VERSION 3.4.10 -ENV MONGO_MAJOR 3.4 -ENV MONGO_PACKAGE mongodb-org - -# PhantomJS -ENV PHANTOM_VERSION 2.1.1 - -# build directories -ENV APP_SOURCE_DIR /opt/meteor/src -ENV APP_BUNDLE_DIR /opt/meteor/dist -ENV BUILD_SCRIPTS_DIR /opt/build_scripts - -# Add entrypoint and build scripts -COPY scripts $BUILD_SCRIPTS_DIR -RUN chmod -R 750 $BUILD_SCRIPTS_DIR +FROM openmove/meteor-launchpad:base +MAINTAINER OpenMove team # Define all --build-arg options ONBUILD ARG APT_GET_INSTALL @@ -53,8 +31,8 @@ ONBUILD RUN if [ "$APT_GET_INSTALL" ]; then apt-get update && apt-get install -y ONBUILD COPY . $APP_SOURCE_DIR # install all dependencies, build app, clean up -ONBUILD RUN cd $APP_SOURCE_DIR && \ - $BUILD_SCRIPTS_DIR/install-deps.sh && \ +ONBUILD RUN cd $APP_SOURCE_DIR && \ + $BUILD_SCRIPTS_DIR/install-deps-opt.sh && \ $BUILD_SCRIPTS_DIR/install-node.sh && \ $BUILD_SCRIPTS_DIR/install-phantom.sh && \ $BUILD_SCRIPTS_DIR/install-graphicsmagick.sh && \ @@ -62,16 +40,3 @@ ONBUILD RUN cd $APP_SOURCE_DIR && \ $BUILD_SCRIPTS_DIR/install-meteor.sh && \ $BUILD_SCRIPTS_DIR/build-meteor.sh && \ $BUILD_SCRIPTS_DIR/post-build-cleanup.sh - -# Default values for Meteor environment variables -ENV ROOT_URL http://localhost -ENV MONGO_URL mongodb://127.0.0.1:27017/meteor -ENV PORT 3000 - -EXPOSE 3000 - -WORKDIR $APP_BUNDLE_DIR/bundle - -# start the app -ENTRYPOINT ["./entrypoint.sh"] -CMD ["node", "main.js"] From b3717b0d8364396a2a626212cad387d27c380f79 Mon Sep 17 00:00:00 2001 From: Michele Margoni Date: Wed, 14 Mar 2018 11:55:02 +0100 Subject: [PATCH 2/2] instruction for the new image tagged onbuild --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff0bb57..9c3c38d 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Add the following to a `Dockerfile` in the root of your app: ```Dockerfile -FROM jshimko/meteor-launchpad:latest +FROM openmove/meteor-launchpad:onbuild ``` Then you can build the image with: