Skip to content

Commit

Permalink
Add node v11 images (#171)
Browse files Browse the repository at this point in the history
* Add node v11 images

* add node v11 tests

* update default image

* update readme
  • Loading branch information
mkenney authored Feb 26, 2019
1 parent afd5d88 commit 0af012e
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 20 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Please feel free to [create an issue](https://github.com/mkenney/docker-npm/issu
- [Installation](#installation)
- [Change log](#change-log)

## Announcements

### v1.1.0 released

2019-02-25

* Added `node` v11 images and tests
* Updated the shell scripts to default to `node-11-alpine` image (you can always use the `DOCKER_NPM_TAG` variable to use another image).

## Tagged Images

Images are tagged according to the installed Node version and operating system. Package versions are not pinned, instead [`npm`](https://npmjs.org/) is executed to install current versions of each package. If stability issues aries, I will pin package versions in a `Dockerfile` for that Node/OS version and create a image tagged as `stable` based on it. Please [let me know](https://github.com/mkenney/docker-npm/issues) if you run into this situation.
Expand All @@ -24,6 +33,10 @@ Images are tagged according to the installed Node version and operating system.

Based on [`node:alpine`](https://hub.docker.com/_/node/). This image should be considered under development and may not be as stable as versioned images.

#### [`node-11-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-11-alpine/Dockerfile)

Based on [`node:11-alpine`](https://hub.docker.com/r/library/node/tags/11-alpine/).

#### [`node-10-alpine` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-10-alpine/Dockerfile)

Based on [`node:10-alpine`](https://hub.docker.com/r/library/node/tags/10-alpine/).
Expand All @@ -50,6 +63,10 @@ Based on [`node:6-alpine`](https://hub.docker.com/r/library/node/tags/6-alpine/)

Based on [`node:latest`](https://hub.docker.com/r/library/node/tags/latest/). This image should be considered under development and may not be as stable as versioned images.

#### [`node-11-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-11-debian/Dockerfile)

Based on [`node:11-stretch`](https://hub.docker.com/r/library/node/tags/11-stretch/).

#### [`node-10-debian` Dockerfile](https://github.com/mkenney/docker-npm/blob/master/node-10-debian/Dockerfile)

Based on [`node:10-wheezy`](https://hub.docker.com/r/library/node/tags/10-wheezy/).
Expand Down Expand Up @@ -84,17 +101,6 @@ Based on[`node:7-wheezy`](https://hub.docker.com/r/library/node/tags/7-wheezy/).

[![stability-locked](https://img.shields.io/badge/stability-locked-4b0088.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#locked) Based on[`node:6.9-wheezy`](https://hub.docker.com/r/library/node/tags/6.9-wheezy/).

## Announcements

### 2018-10-21

* Added `npx` [thanks to @dagomar](#142)
* Added mounting `$HOME/.npm` to the wrapper scripts to allow various tools to take advantage of the cache [thanks to @jgoux](#167)
* [Added a variable](https://github.com/mkenney/docker-npm/issues/167#issuecomment-430861154) for passing flags to the `docker` command [thanks to @jgoux](#167):
```
DOCKER_NPM_ARGS="-p 3000:3000" yarn start
```

## About

Essentially, this is just a set of [shell scripts](https://github.com/mkenney/docker-npm/tree/master/bin) that manage a [Node.js](https://nodejs.org/) docker image. The docker image includes a script ([`run-as-user`](https://github.com/mkenney/docker-scripts/tree/master/container)) that allows commands to write files as either the current user or the owner/group of the current directory, which the shell scripts take advantage of to make sure files are created with your preferred permissions rather than root.
Expand Down
2 changes: 1 addition & 1 deletion bin/bower
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/generate-md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/grunt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/gulp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/node
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/npm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/npx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/yarn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

TAG=node-10-alpine
TAG=node-11-alpine
if [ "" != "$DOCKER_NPM_TAG" ]; then
TAG="$DOCKER_NPM_TAG"
fi
Expand Down
6 changes: 6 additions & 0 deletions node-11-alpine/.image-tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is used to define which image tags are triggered for build in CI
# deployments

declare -a TAGS=(
'node-11-alpine'
)
89 changes: 89 additions & 0 deletions node-11-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
FROM node:11-alpine

LABEL org.label-schema.schema-version = 1.0.0 \
org.label-schema.vendor = [email protected] \
org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \
org.label-schema.description = "This image provides node based build tools." \
org.label-schema.name = "NPM" \
org.label-schema.url = http://mkenney.github.io/docker-npm/

ENV TERM=xterm \
NLS_LANG=American_America.AL32UTF8 \
LANG=C.UTF-8 \
LANGUAGE=C.UTF-8 \
LC_ALL=C.UTF-8 \
TIMEZONE=America/Denver

########################################################################
# Build tools
########################################################################
RUN set -x \
&& apk update \
&& apk add \
acl \
ca-certificates \
curl \
git \
gnupg \
mercurial \
rsync \
shadow \
subversion \
sudo

RUN set -x \
&& touch /root/.profile \
# Install node packages
&& npm install --silent -g \
gulp-cli \
grunt-cli \
bower \
markdown-styles \
npx \
# Configure root account
&& echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.profile \
&& echo "export LANG=$(echo $LANG)" >> /root/.profile \
&& echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.profile \
&& echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.profile \
&& echo "export TERM=xterm" >> /root/.profile \
&& echo "export PATH=$(echo $PATH)" >> /root/.profile \
&& echo "cd /src" >> /root/.profile \
# Create a dev user to use as the directory owner
&& addgroup dev \
&& adduser -D -s /bin/sh -G dev dev \
&& echo "dev:password" | chpasswd \
&& curl --compressed -o- -L https://yarnpkg.com/install.sh | sh \
&& rsync -a /root/ /home/dev/ \
&& chown -R dev:dev /home/dev/ \
&& chmod 0777 /home/dev \
&& chmod -R u+rwX,g+rwX,o+rwX /home/dev \
&& setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev \
# Setup wrapper scripts
&& curl -o /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \
&& chmod 0755 /run-as-user

##############################################################################
# ~ fin ~
##############################################################################

RUN set -x \
&& apk del \
curl \
gnupg \
linux-headers \
paxctl \
python \
rsync \
tar \
&& rm -rf \
/var/cache/apk/* \
${NODE_PREFIX}/lib/node_modules/npm/man \
${NODE_PREFIX}/lib/node_modules/npm/doc \
${NODE_PREFIX}/lib/node_modules/npm/html


VOLUME /src
WORKDIR /src

ENTRYPOINT ["/run-as-user"]
CMD ["/usr/local/bin/npm"]
6 changes: 6 additions & 0 deletions node-11-debian/.image-tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is used to define which image tags are triggered for build in CI
# deployments

declare -a TAGS=(
'node-11-debian'
)
102 changes: 102 additions & 0 deletions node-11-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
FROM node:11-stretch

LABEL org.label-schema.schema-version = 1.0.0 \
org.label-schema.vendor = [email protected] \
org.label-schema.vcs-url = https://github.com/mkenney/docker-npm \
org.label-schema.description = "This image provides node based build tools." \
org.label-schema.name = "NPM" \
org.label-schema.url = http://mkenney.github.io/docker-npm/

ENV TERM=xterm \
NLS_LANG=American_America.AL32UTF8 \
LANG=C.UTF-8 \
LANGUAGE=C.UTF-8 \
LC_ALL=C.UTF-8 \
TIMEZONE=America/Denver

RUN set -x \
&& apt-get -qq update \
&& apt-get install -qqy apt-transport-https apt-utils \
&& apt-get -qq upgrade \
&& apt-get -qq dist-upgrade \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get -qq update \
&& apt-get install -qqy \
acl \
git \
mercurial \
rsync \
subversion \
sudo \
wget \
# Restore a borne-shell compatible default shell
&& rm /bin/sh \
&& ln -s /bin/bash /bin/sh


# install npm packages
RUN set -x \
&& npm install --silent --global \
gulp-cli \
grunt-cli \
bower \
markdown-styles \
npx \
&& curl --compressed -o- -L https://yarnpkg.com/install.sh | sh

##############################################################################
# UTF-8 Locale, timezone
##############################################################################

RUN set -x \
&& apt-get install -qqy locales \
&& locale-gen C.UTF-8 ${UTF8_LOCALE} \
&& dpkg-reconfigure locales \
&& /usr/sbin/update-locale LANG=C.UTF-8 LANGUAGE=C.UTF-8 LC_ALL=C.UTF-8 \
&& export LANG=C.UTF-8 \
&& export LANGUAGE=C.UTF-8 \
&& export LC_ALL=C.UTF-8 \
&& echo $TIMEZONE > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata

##############################################################################
# users
##############################################################################

RUN set -x \
# Configure root account
&& echo "export NLS_LANG=$(echo $NLS_LANG)" >> /root/.bash_profile \
&& echo "export LANG=$(echo $LANG)" >> /root/.bash_profile \
&& echo "export LANGUAGE=$(echo $LANGUAGE)" >> /root/.bash_profile \
&& echo "export LC_ALL=$(echo $LC_ALL)" >> /root/.bash_profile \
&& echo "export TERM=xterm" >> /root/.bash_profile \
&& echo "export PATH=$(echo $PATH)" >> /root/.bash_profile \
&& echo "cd /src" >> /root/.bash_profile \
&& echo "source \$HOME/.bashrc" >> /root/.bash_profile \
# Add a dev user and configure
&& groupadd dev \
&& useradd dev -s /bin/bash -m -g dev \
&& echo "dev:password" | chpasswd \
&& echo "dev ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& rsync -a /root/ /home/dev/ \
&& chown -R dev:dev /home/dev/ \
&& chmod 0777 /home/dev \
&& chmod -R u+rwX,g+rwX,o+rwX /home/dev \
&& setfacl -R -d -m user::rwx,group::rwx,other::rwx /home/dev

##############################################################################
# ~ fin ~
##############################################################################

RUN set -x \
&& wget -O /run-as-user https://raw.githubusercontent.com/mkenney/docker-scripts/master/container/run-as-user \
&& chmod 0755 /run-as-user \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

VOLUME /src
WORKDIR /src

ENTRYPOINT ["/run-as-user"]
CMD ["/usr/local/bin/npm"]
2 changes: 1 addition & 1 deletion test/lib/add-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ add_tests() {
release)
tests="1.build;install;bower;md;grunt;gulp;node;npm;npx;yarn"
;;
node-alpine/*|node-debian/*|node-10-alpine/*|node-10-debian/*|node-9-alpine/*|node-9-debian/*|node-8-alpine/*|node-8-debian/*|node-7-alpine/*|node-7-debian/*|node-7.7-alpine/*|node-7.0-debian/*|node-6.9-alpine/*|node-6.9-debian/*|node-6-alpine/*|node-6-debian/*)
node-alpine/*|node-debian/*|node-11-alpine/*|node-11-debian/*|node-10-alpine/*|node-10-debian/*|node-9-alpine/*|node-9-debian/*|node-8-alpine/*|node-8-debian/*|node-7-alpine/*|node-7-debian/*|node-7.7-alpine/*|node-7.0-debian/*|node-6.9-alpine/*|node-6.9-debian/*|node-6-alpine/*|node-6-debian/*)
tests="1.build"
;;
.travis.yml)
Expand Down

0 comments on commit 0af012e

Please sign in to comment.