Skip to content

Instantly share code, notes, and snippets.

@LaurentGoderre
Forked from EnzoMartin/Dockerfile
Created March 30, 2017 12:28
Show Gist options
  • Save LaurentGoderre/cb04c9845fbd9e739e363489f0e559a0 to your computer and use it in GitHub Desktop.
Save LaurentGoderre/cb04c9845fbd9e739e363489f0e559a0 to your computer and use it in GitHub Desktop.

Revisions

  1. @EnzoMartin EnzoMartin revised this gist Mar 30, 2017. 2 changed files with 2 additions and 0 deletions.
    1 change: 1 addition & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # Runtime image
    # Following https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
    FROM node:7.7-alpine

    1 change: 1 addition & 0 deletions Dockerfile.build
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # Build image
    FROM node:7.7-alpine

    # Enables colored output in jenkins logs
  2. @EnzoMartin EnzoMartin created this gist Mar 30, 2017.
    16 changes: 16 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Following https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
    FROM node:7.7-alpine

    # Add tini
    RUN apk add --no-cache tini
    ENTRYPOINT ["/sbin/tini", "--"]

    WORKDIR /usr/src/app/

    # Copy built application modules
    COPY ./src/ ./node_modules/

    # Copy application files
    COPY . ./

    CMD [ "node", "service/start.js" ]
    34 changes: 34 additions & 0 deletions Dockerfile.build
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    FROM node:7.7-alpine

    # Enables colored output in jenkins logs
    ENV FORCE_COLOR=true \
    TERM=xterm \
    CI=true

    # Set npm auth token
    ARG NPM_TOKEN
    RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc \
    && echo "progress=false" >> /root/.npmrc \
    && echo "color=true" >> /root/.npmrc

    # Create app directory
    WORKDIR /usr/src/app/

    # Copy package.json and shrinkwrap if present
    COPY *.json ./

    # Add packages needed to build native dependencies
    RUN apk add --no-cache \
    git \
    python \
    python-dev \
    py-pip \
    build-base \
    libc6-compat \
    && pip install virtualenv

    # Install modules
    RUN npm install --quiet

    # Copy over the application code so we can run lint, tests, etc.
    COPY . ./