From 481607555123ed8a48cc72248ad746121c9cbf40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marian=20Kl=C3=BChspies?= Date: Sat, 9 Dec 2017 16:24:56 +0100 Subject: [PATCH 1/4] PRE_INSTALL_SCRIPT build param added --- .gitignore | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 8 ++++++++ README.md | 1 + 3 files changed, 61 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3560bc0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,52 @@ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + diff --git a/Dockerfile b/Dockerfile index 3e7f1c4..8094089 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,9 @@ RUN chmod -R 750 $BUILD_SCRIPTS_DIR ONBUILD ARG APT_GET_INSTALL ONBUILD ENV APT_GET_INSTALL $APT_GET_INSTALL +ONBUILD ARG PRE_INSTALL_SCRIPTS +ONBUILD ENV PRE_INSTALL_SCRIPTS $PRE_INSTALL_SCRIPTS + ONBUILD ARG NODE_VERSION ONBUILD ENV NODE_VERSION ${NODE_VERSION:-8.9.0} @@ -46,6 +49,11 @@ ONBUILD ENV INSTALL_GRAPHICSMAGICK $INSTALL_GRAPHICSMAGICK ONBUILD ARG TOOL_NODE_FLAGS ONBUILD ENV TOOL_NODE_FLAGS $TOOL_NODE_FLAGS +# optionally run scripts before launchpad installation to cache big dependencies in lower layer that don´t change often +ONBUILD COPY ./$PRE_INSTALL_SCRIPTS $BUILD_SCRIPTS_DIR +ONBUILD RUN echo $(ls -1 $BUILD_SCRIPTS_DIR) +ONBUILD RUN if [ "$PRE_INSTALL_SCRIPTS" ]; then $BUILD_SCRIPTS_DIR/$PRE_INSTALL_SCRIPTS; fi + # optionally custom apt dependencies at app build time ONBUILD RUN if [ "$APT_GET_INSTALL" ]; then apt-get update && apt-get install -y $APT_GET_INSTALL; fi diff --git a/README.md b/README.md index ff0bb57..0643dc3 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ If you prefer not to have a config file in your project, your other option is to ```sh docker build \ --build-arg APT_GET_INSTALL="curl git wget" \ + --build-arg PRE_INSTALL_SCRIPT="yourscript.sh" \ --build-arg INSTALL_MONGO=true \ --build-arg NODE_VERSION=8.9.0 \ -t myorg/myapp:latest . From 4ce1cdae2dadd57f462aa5d3bf725daa91422e1e Mon Sep 17 00:00:00 2001 From: Nachbar90 Date: Sat, 9 Dec 2017 16:30:06 +0100 Subject: [PATCH 2/4] PRE_INSTALL_SCRIPT build param added --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8094089..0c9db67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,6 @@ ONBUILD ENV TOOL_NODE_FLAGS $TOOL_NODE_FLAGS # optionally run scripts before launchpad installation to cache big dependencies in lower layer that don´t change often ONBUILD COPY ./$PRE_INSTALL_SCRIPTS $BUILD_SCRIPTS_DIR -ONBUILD RUN echo $(ls -1 $BUILD_SCRIPTS_DIR) ONBUILD RUN if [ "$PRE_INSTALL_SCRIPTS" ]; then $BUILD_SCRIPTS_DIR/$PRE_INSTALL_SCRIPTS; fi # optionally custom apt dependencies at app build time From 9c66db81b01cd31b857d8ab870b681eadb82477f Mon Sep 17 00:00:00 2001 From: Nachbar90 Date: Sat, 9 Dec 2017 16:30:54 +0100 Subject: [PATCH 3/4] PRE_INSTALL_SCRIPT build param added --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c9db67..7e1596b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,8 @@ RUN chmod -R 750 $BUILD_SCRIPTS_DIR ONBUILD ARG APT_GET_INSTALL ONBUILD ENV APT_GET_INSTALL $APT_GET_INSTALL -ONBUILD ARG PRE_INSTALL_SCRIPTS -ONBUILD ENV PRE_INSTALL_SCRIPTS $PRE_INSTALL_SCRIPTS +ONBUILD ARG PRE_INSTALL_SCRIPT +ONBUILD ENV PRE_INSTALL_SCRIPT $PRE_INSTALL_SCRIPT ONBUILD ARG NODE_VERSION ONBUILD ENV NODE_VERSION ${NODE_VERSION:-8.9.0} @@ -50,8 +50,8 @@ ONBUILD ARG TOOL_NODE_FLAGS ONBUILD ENV TOOL_NODE_FLAGS $TOOL_NODE_FLAGS # optionally run scripts before launchpad installation to cache big dependencies in lower layer that don´t change often -ONBUILD COPY ./$PRE_INSTALL_SCRIPTS $BUILD_SCRIPTS_DIR -ONBUILD RUN if [ "$PRE_INSTALL_SCRIPTS" ]; then $BUILD_SCRIPTS_DIR/$PRE_INSTALL_SCRIPTS; fi +ONBUILD COPY ./$PRE_INSTALL_SCRIPT $BUILD_SCRIPTS_DIR +ONBUILD RUN if [ "$PRE_INSTALL_SCRIPT" ]; then $BUILD_SCRIPTS_DIR/$PRE_INSTALL_SCRIPT; fi # optionally custom apt dependencies at app build time ONBUILD RUN if [ "$APT_GET_INSTALL" ]; then apt-get update && apt-get install -y $APT_GET_INSTALL; fi From bc38174229139f3e7a2da120e74468d9c655800c Mon Sep 17 00:00:00 2001 From: Nachbar90 Date: Sat, 9 Dec 2017 16:33:23 +0100 Subject: [PATCH 4/4] PRE_INSTALL_SCRIPT added to dev.dockerfile --- dev.dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev.dockerfile b/dev.dockerfile index 8911919..a004b6b 100644 --- a/dev.dockerfile +++ b/dev.dockerfile @@ -33,6 +33,9 @@ RUN bash $BUILD_SCRIPTS_DIR/install-deps.sh && \ ONBUILD ARG APT_GET_INSTALL ONBUILD ENV APT_GET_INSTALL $APT_GET_INSTALL +ONBUILD ARG PRE_INSTALL_SCRIPT +ONBUILD ENV PRE_INSTALL_SCRIPT $PRE_INSTALL_SCRIPT + ONBUILD ARG NODE_VERSION ONBUILD ENV NODE_VERSION ${NODE_VERSION:-8.9.0} @@ -45,6 +48,10 @@ ONBUILD ENV INSTALL_PHANTOMJS ${INSTALL_PHANTOMJS:-true} ONBUILD ARG INSTALL_GRAPHICSMAGICK ONBUILD ENV INSTALL_GRAPHICSMAGICK ${INSTALL_GRAPHICSMAGICK:-true} +# optionally run scripts before launchpad installation to cache big dependencies in lower layer that don´t change often +ONBUILD COPY ./$PRE_INSTALL_SCRIPT $BUILD_SCRIPTS_DIR +ONBUILD RUN if [ "$PRE_INSTALL_SCRIPT" ]; then $BUILD_SCRIPTS_DIR/$PRE_INSTALL_SCRIPT; fi + # optionally custom apt dependencies at app build time ONBUILD RUN if [ "$APT_GET_INSTALL" ]; then apt-get update && apt-get install -y $APT_GET_INSTALL; fi