Sign inSign up

viniokil/node

By viniokil

•Updated almost 7 years ago

NodeJS with dependencies for build application images

Image
0

509

viniokil/node repository overview

logo

⁠NodeJS with dependencies for build application images

Based on official NodeJS alpine images.

Applications from base images:

  • node
  • yarn
  • npm

Installed applications list::

  • git
  • curl
  • ssh-client
  • rsync
  • python
  • httpie
  • jq
  • netcat-openbsd
  • compile tools

⁠Tags

docker imageNodeJS version
viniokil/node:88
viniokil/node:1010
viniokil/node:1212
viniokil/node:1313
viniokil/node:lts12
viniokil/node:latest13

⁠How can I use this?

For example:

$ docker run --rm \
    --volume "$PWD:/app" \
    --workdir "/app" \
    --user "$(id -u):$(id -g)" \
    viniokil/node:8 \
    npm install

Or using with docker-compose.yml:

services:
  node:
    image: viniokil/node:8
    volumes:
    - ./src:/app:rw
    working_dir: /app
    command: []
⁠Multistage build docker
FROM viniokil/node:latest as Builder

# Add deploy ssh keys only for docker image building
ARG ssh_prv_key

WORKDIR /app

COPY ./source/ /app

# Authorize SSH Host
RUN mkdir -p /root/.ssh \
        && chmod 0700 /root/.ssh \
        && ssh-keyscan -p 22 github.com > /root/.ssh/known_hosts

# Add the keys and set permissions
RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa \
        && chmod 600 /root/.ssh/id_rsa \
        && eval $(ssh-agent) \
        && ssh-add /root/.ssh/id_rsa 

RUN if [ -f yarn.lock ]; then yarn install; else npm install; fi

# Remove SSH keys
RUN rm -rf /root/.ssh/


#################################################################
##################### Build clear app image #####################

FROM node:alpine

COPY --from=Builder /app /app

WORKDIR /app

EXPOSE 3000

CMD [ "npm", "start" ]
⁠Run multistage build
docker build --build-arg ssh_prv_key="$(cat ~/.ssh/id_rsa)" .

Tag summary

Content type

Image

Digest

Size

137.1 MB

Last updated

almost 7 years ago

docker pull viniokil/node