安装最新稳定版本的nodejs Dockerfile

时间:2017-02-02 22:08:47

标签: node.js dockerfile

Dockerfile的以下部分安装节点,但默认为v。4.2.6,如何安装最新的稳定版本7.4.0

RUN apt-get clean && apt-get update \
    && apt-get -yqq install \
    apache2 \
    nodejs \ ## nodejs installed here
    php \
    php-mcrypt \
    php-curl \
    php-mbstring \
    php-xml \
    php-zip \
    libapache2-mod-php \
    php-mysql \
    git \
    supervisor \
    && apt-get -y autoremove \
    && apt-get clean \
    && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
    && ln -sf /dev/stdout /var/log/apache2/access.log \
    && ln -sf /dev/stderr /var/log/apache2/error.log

2 个答案:

答案 0 :(得分:1)

根据nodejs.org的文档,您可以通过以下方式安装它:

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - sudo apt-get install -y nodejs

所以你的Dockerfile可能是这样的:

RUN curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash \ && apt-get clean && apt-get update \ && apt-get -yqq install \ apache2 \ nodejs \ ## It should be the good version

答案 1 :(得分:0)

import cv2
import numpy as np

# Read an input image (in your case this will be an image from the camera)
img = cv2.imread('saul2.png ', cv2.IMREAD_COLOR)

# The block_size defines how big the patches around an image are
# the more LEDs you have and the more segments you want, the lower block_size can be
block_size = 60

# Get dimensions of an image
height, width, chan = img.shape

# Calculate number of patches along height and width
h_steps = height / block_size
w_steps = width / block_size

# In one loop I calculate both: left and right ambient or top and bottom
ambient_patch1 = np.zeros((60, 60, 3))
ambient_patch2 = np.zeros((60, 60, 3))

# Create output image (just for visualization
# there will be an input image in the middle, 10px black border and ambient color)
output = cv2.copyMakeBorder(img, 70, 70, 70, 70, cv2.BORDER_CONSTANT, value = 0)

for i in range(h_steps):
    # Get left and right region of an image
    left_roi = img[i * 60 : (i + 1) * 60, 0 : 60]
    right_roi = img[i * 60 : (i + 1) * 60, -61 : -1]

    left_med = np.median(left_roi, (0, 1)) # This is an actual RGB color for given block (on the left)
    right_med = np.median(right_roi, (0, 1)) # and on the right

    # Create patch having an ambient color - this is just for visualization
    ambient_patch1[:, :] = left_med
    ambient_patch2[:, :] = right_med

    # Put it in the output image (the additional 70 is because input image is in the middle (shifted by 70px)
    output[70 + i * 60 : 70+ (i + 1) * 60, 0 : 60] = ambient_patch1
    output[70 + i * 60 : 70+ (i + 1) * 60, -61: -1] = ambient_patch2


for i in range(w_steps):
    # Get top and bottom region of an image
    top_roi = img[0 : 60, i * 60 : (i + 1) * 60]
    bottom_roi = img[-61 : -1, i * 60: (i + 1) * 60]

    top_med = np.median(top_roi, (0, 1)) # This is an actual RGB color for given block (on top)
    bottom_med = np.median(bottom_roi, (0, 1)) # and bottom

    # Create patch having an ambient color - this is just for visualization
    ambient_patch1[:, :] = top_med
    ambient_patch2[:, :] = bottom_med

    # Put it in the output image (the additional 70 is because input image is in the middle (shifted by 70px)
    output[0 : 60, 70 + i * 60 : 70 + (i + 1) * 60] = ambient_patch1
    output[-61: -1, 70 + i * 60 : 70 + (i + 1) * 60] = ambient_patch2

# Save output image
cv2.imwrite('saul_output.png', output)
相关问题