From 2c5ba2feea22ff0327040a8db263dae80950f22b Mon Sep 17 00:00:00 2001 From: Ciaran Moran <25228551+morancj@users.noreply.github.com> Date: Wed, 20 Nov 2019 13:27:03 +0000 Subject: [PATCH] feat: support building under Docker --- build_netlify.sh | 8 ++++++++ docker_build_netlify-cms.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 build_netlify.sh create mode 100644 docker_build_netlify-cms.sh diff --git a/build_netlify.sh b/build_netlify.sh new file mode 100644 index 000000000000..a3f71f27123d --- /dev/null +++ b/build_netlify.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +set -x + +mkdir -p ".yarn" ".yarn_cache" +yarn --global-folder "$(pwd)/.yarn" --cache-folder "$(pwd)/.yarn_cache" +yarn bootstrap +yarn build diff --git a/docker_build_netlify-cms.sh b/docker_build_netlify-cms.sh new file mode 100644 index 000000000000..88cf412a0609 --- /dev/null +++ b/docker_build_netlify-cms.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Exit on errors +set -e +set -x + +# Variables +DOCKER_SOURCE_IMAGE="node" +DOCKER_IMAGE_VERSION="13.1.0-stretch-slim" +HOSTNAME="$(hostname)" +USER="$(id -u)" +GROUP="$(id -g)" +CURRENT_DIR="$(pwd)" +DOCKER_WORKDIR="${HOME}" + +docker run\ + --cap-drop=all\ + --memory=4GB\ + --rm\ + -i\ + -v "${CURRENT_DIR}":"${DOCKER_WORKDIR}"\ + -v /etc/group:/etc/group:ro\ + -v /etc/passwd:/etc/passwd:ro\ + -u "${USER}":"${GROUP}"\ + -w "${DOCKER_WORKDIR}"\ + --hostname="${HOSTNAME}"-netlify-builder-13-1-0\ + --name=netlify_builder\ + "${DOCKER_SOURCE_IMAGE}":"${DOCKER_IMAGE_VERSION}"\ + /bin/bash -c "${DOCKER_WORKDIR}/build_netlify.sh"