Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
bug 1468491: Update Python3 test image for node 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhitlock committed Jul 17, 2018
1 parent 3b7824b commit fa86a38
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions docker/images/kuma_base/Dockerfile-py3
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.6-slim

# Set the environment variables
ENV NODE_VERSION=6.14.2 \
ENV NODE_VERSION=8.11.3 \
# extra python env
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
Expand All @@ -21,7 +21,6 @@ RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
xz-utils \
gpg \
dirmngr \
libsasl2-modules \
Expand All @@ -39,11 +38,15 @@ RUN set -x \
&& rm -rf /var/lib/apt/lists/*

# ----------------------------------------------------------------------------
# add node.js 6.x, copied from:
# https://github.com/nodejs/docker-node/blob/master/6/stretch/Dockerfile
# but with package updates and version definitions moved above
# add node.js 8.x, copied from:
# https://github.com/nodejs/docker-node/blob/master/8/stretch/Dockerfile
# but with package updates and version definitions moved above, and the node
# user gets uid/gid 1001 rather than 1000.
# ----------------------------------------------------------------------------

RUN groupadd --gid 1001 node \
&& useradd --uid 1001 --gid node --shell /bin/bash --create-home node

RUN set -ex \
&& for key in \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
Expand All @@ -54,6 +57,7 @@ RUN set -ex \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
56730D5401028683275BD23C23EFEFE93C4CFFFE \
77984A986EBC2AA786BC0F66B01FBB92821C587A \
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
; do \
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
Expand All @@ -79,24 +83,33 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
# ----------------------------------------------------------------------------

# add non-priviledged user
RUN adduser --uid 1000 --disabled-password --gecos '' --no-create-home kuma
# add non-privileged user
RUN useradd --uid 1000 --shell /bin/bash --create-home kuma \
&& mkdir -p app \
&& chown kuma:kuma /app \
&& chmod 775 /app

# install Python libraries
WORKDIR /app
EXPOSE 8000

RUN npm install -g \
fibers@1.0.15 \
csslint@0.10.0 \
jshint@2.7.0 \
node-sass@4.3.0 \
uglify-js@2.4.13 \
clean-css@3.4.23 \
stylelint@7.10.1

COPY ./requirements /app/requirements
COPY --chown=kuma:kuma ./requirements /app/requirements
RUN pip install --no-cache-dir -r requirements/dev.txt

# install Node.js tools
# config files are symlinks to make updating easier
COPY --chown=kuma:kuma ./package.json ./npm-shrinkwrap.json /app/
RUN mkdir /tools \
&& chown kuma:kuma /tools \
&& chmod 775 /tools
WORKDIR /tools
USER kuma
RUN ln -s /app/package.json /tools \
&& ln -s /app/npm-shrinkwrap.json /tools \
&& npm install --production
USER root
RUN find /tools/node_modules/.bin/ -executable -type f -o -type l -exec ln -s {} /usr/local/bin/ \;

# setup default run parameters
USER kuma
WORKDIR /app
EXPOSE 8000
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--timeout=120", "--worker-class=meinheld.gmeinheld.MeinheldWorker", "kuma.wsgi:application"]

0 comments on commit fa86a38

Please sign in to comment.