Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #16 from divio/topic/alpine
Browse files Browse the repository at this point in the history
Convert to work on both debian and alpine images
  • Loading branch information
glasnt committed Feb 9, 2018
2 parents 90efdd6 + a9ac253 commit 60f96e2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
# <NODE>
ADD tools/build /stack/boilerplate

ENV NODE_VERSION=6.10.1 \
NPM_VERSION=3.10.10

RUN bash /stack/boilerplate/install.sh
ENV NODE_VERSION=8.9.4 \
NPM_VERSION=5.4.0

RUN sh /stack/boilerplate/install.sh
ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules \
PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# </NODE>

# <DOCKER_BUILD>
Expand Down
7 changes: 5 additions & 2 deletions tools/build/install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash
#!/bin/sh

set -e

SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")
OS_RELEASE=$(cat /etc/os-release | grep "^ID=" | cut -d= -f2)

bash ${BASEDIR}/node.sh
chmod +x ${BASEDIR}/*.sh

${BASEDIR}/node-${OS_RELEASE}.sh
19 changes: 19 additions & 0 deletions tools/build/node-alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
set -e

# Node installation for Alpine systems
apk update

# Get exact package version where rN isn't known
NODE_APK_REV=$(apk search nodejs | grep nodejs-$NODE_VERSION | rev | cut -d'-' -f1 | rev )
NODE_APK=nodejs@edge=$NODE_VERSION-$NODE_APK_REV

# Intentionally using NODE version for NPM
NPM_APK_REV=$(apk search nodejs-npm | grep nodejs-npm-$NODE_VERSION | rev | cut -d'-' -f1 | rev )
NPM_APK=nodejs-npm@edge=$NODE_VERSION-$NPM_APK_REV

apk add python2 libuv@edge $NODE_APK $NPM_APK

npm install npm@"$NPM_VERSION"
npm install -g gulp bower

17 changes: 17 additions & 0 deletions tools/build/node-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

source $NVM_DIR/nvm.sh

# ensure python2 is available by name for gyp
if [ ! -f /usr/bin/python2 ]; then
apt-get update && apt-get install -y python2.7 --no-install-recommends
ln -sn /usr/bin/python2.7 /usr/bin/python2
fi

nvm install $NODE_VERSION
nvm alias default $NODE_VERSION
nvm use default

npm install -g npm@"$NPM_VERSION"
npm install -g gulp bower
11 changes: 0 additions & 11 deletions tools/build/node.sh

This file was deleted.

0 comments on commit 60f96e2

Please sign in to comment.