Skip to content

Commit

Permalink
Dockerfile update for node
Browse files Browse the repository at this point in the history
Merged all process in one single RUN to save image space and also remove node user. Can not be used with rpi-alpine-base due to just-containers/s6-overlay#207
  • Loading branch information
xcafebabe committed Aug 2, 2017
1 parent 4d11c38 commit 4ea6995
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
17 changes: 6 additions & 11 deletions node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
FROM kafebob/rpi-alpine:3.6
FROM kafebob/rpi-alpine-base:3.6
MAINTAINER Luis Toubes <[email protected]>

ENV NVM_VERSION=v0.33.2 NODE_VERSION=v8.2.1 PROFILE=/home/node/.bashrc
ENV NVM_VERSION=v0.33.2 NODE_VERSION=v8.2.1 PROFILE=/root/.bashrc

RUN apk add --update --no-cache curl bash \
ca-certificates openssl coreutils && \
apk add --update --no-cache --virtual build-dependencies ncurses python2 \
make gcc g++ libgcc linux-headers && \
addgroup -g 1000 node && \
adduser -u 1000 -G node -s /bin/bash -h /home/node -D node

USER node
RUN cd /home/node && \
cd /root && \
curl -o- https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh | bash && \
echo "#NVM Setup" >> $PROFILE && \
echo 'export NVM_DIR="$HOME/.nvm"' >> $PROFILE && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> $PROFILE && \
source $PROFILE && \
nvm install -s $NODE_VERSION --fully-static && \
rm -rf /home/node/.nvm/.cache/src/node-$NODE_VERSION

USER root
RUN apk del build-dependencies && \
rm -rf /root/.nvm/.cache/src/node-$NODE_VERSION && \
apk del build-dependencies && \
rm -rf /tmp/* /var/cache/apk/*
28 changes: 28 additions & 0 deletions node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Alpine Node Images

## Node Image

In order to build your own Node Image for your Raspberry Pi based on `gliderlabs/alpine`

```
git clone https://github.com/xcafebabe/gobstoppers.git && \
cd gobstoppers/node && \
sudo docker build -t kafebob/rpi-alpine-node:latest .
```

Be patient is going to take a while.

By default is going to use as image name `kafebob/rpi-alpine-node` and as tag version `latest`

You can change these names creating two environment variables

```
export IMAGE_VERSION=8.2.1 && \
export IMAGE_NAME=kafebob/rpi-alpine-node
```

If you just want to use latest image available, pull a copy from DockerHub

```
sudo docker pull kafebob/rpi-alpine-node:latest
```

0 comments on commit 4ea6995

Please sign in to comment.