nodejs dockerfile

nodesjs 基础镜像

FROM centos:centos7.9.2009

MAINTAINER fengjian <fengjian1585@163.com>

ENV TZ "Asia/Shanghai"
ENV TERM xterm
ENV NODE_HOME=/usr/local/node
ENV PATH $PATH:$NODE_HOME/bin

ENV TimeZone=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone

ADD node.tar.gz /usr/local/

RUN rm /etc/yum.repos.d/* -rf
ADD Centos-7.repo /etc/yum.repos.d/
ADD epel.repo /etc/yum.repos.d/
RUN yum clean all
RUN yum -y install net-tools bind-utils sysstat telnet 
ADD profile /etc
ADD 20-nproc.conf /etc/security/limits.d/
ADD limits.conf /etc/security/
RUN mkdir -p /data/webserver && \
    rm /var/cache/* -rf && \
    source /etc/profile && \
    npm install forever -g && \
    npm install -g express-generator && \
    npm install -g express && \
    npm install -g mysql && \
    npm install -g body-parser

 

 

启动服务镜像

[root@172-16-6-22 bigdata-bj-prod-api-nodejs]# cat Dockerfile 
FROM 172.22.128.224/source/nodejs12.18.2

MAINTAINER fengjian <fengjian1585@163.com>

COPY serve /data/webserver/serve

WORKDIR  /data/webserver/serve

RUN ln -s /usr/local/node/lib/node_modules /data/webserver/serve/

EXPOSE 80

CMD forever -c node  index.js

 

posted @ 2022-02-23 11:15  fengjian1585  阅读(245)  评论(0编辑  收藏  举报