Skip to content

Instantly share code, notes, and snippets.

@elgalu
Created July 14, 2016 06:59
Show Gist options
  • Save elgalu/b41ac82652d3eba21bbe59fa061aadd2 to your computer and use it in GitHub Desktop.
Save elgalu/b41ac82652d3eba21bbe59fa061aadd2 to your computer and use it in GitHub Desktop.
# For https://github.com/elgalu/docker-selenium/issues/113
FROM elgalu/selenium
USER root
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true
###############
# Install git #
###############
RUN add-apt-repository ppa:git-core/ppa \
&& apt-get update -qqy \
&& apt-get -qqy install \
git \
&& rm -rf /var/lib/apt/lists/*
USER ${NORMAL_USER}
################
# Install node #
################
ENV NVM_DIR="${NORMAL_USER_HOME}/.nvm" \
NODE_VERSION="4.2.1" \
PATH=./node_modules/.bin:${PATH}
RUN curl -o- "https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh" | sh
RUN . ${NVM_DIR}/nvm.sh \
&& nvm install ${NODE_VERSION}
RUN . ${NVM_DIR}/nvm.sh \
&& nvm use ${NODE_VERSION} \
&& nvm alias default ${NODE_VERSION} \
&& npm install -g npm
ENV PATH=${NVM_DIR}/versions/node/v${NODE_VERSION}/bin:${PATH} \
MANPATH=${NVM_DIR}/versions/node/v{NODE_VERSION}/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man \
NVM_PATH=${NVM_DIR}/versions/node/v{NODE_VERSION}/lib/node \
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist \
NVM_BIN=${NVM_DIR}/versions/node/v{NODE_VERSION}/bin
# App test code
ENV APP_WORKDIR=${NORMAL_USER_HOME}/app
RUN mkdir -p ${APP_WORKDIR}
ADD . ${APP_WORKDIR}
WORKDIR ${APP_WORKDIR}
# install dev testing dependencies
RUN . ${NVM_DIR}/nvm.sh && nvm use \
&& npm install
# fix perms
RUN sudo chown -R ${NORMAL_USER}:${NORMAL_GROUP} ${SEL_HOME} \
&& sudo chown -R ${NORMAL_USER}:${NORMAL_GROUP} ${NORMAL_USER_HOME}
# build
RUN . ${NVM_DIR}/nvm.sh && nvm use \
&& gulp build
# Restore
ENV DEBIAN_FRONTEND="" \
DEBCONF_NONINTERACTIVE_SEEN=""
# Our custom docker-selenium config
ENV SELENIUM_HUB_PORT=4444 \
VIDEO=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment