【问题标题】:Node8 and Nginx DockerfileNode8 和 Nginx Dockerfile
【发布时间】:2020-11-13 13:25:41
【问题描述】:

祝大家有美好的一天。 有一个带有NODE 8的Dockerfile,需要在容器中安装Nginx才能启用gzip,为此https://dev.to/subhransu/nevertheless-subhransu-maharana-coded-5eam 不起作用。这里是 Dockerfile

FROM node:8 as a builder

COPY . /app/

WORKDIR /app/
ENV PORT=3000
ADD id_rsa /root/.ssh/id_rsa

RUN chmod 600 /root/.ssh/id_rsa && \
    chmod 0700 /root/.ssh && \
    ssh-keyscan bitbucket.org > /root/.ssh/known_hosts && \
    apt update -qqy && \
    apt -qqy install \
    ruby \
    ruby-dev \
    yarn \
    locales \
    autoconf automake gdb git libffi-dev zlib1g-dev libssl-dev \
    build-essential
RUN gem install compass
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

RUN npm ci && \
node ./node_modules/gulp/bin/gulp.js client && \
rm -rf /app/id_rsa \
rm -rf /root/.ssh/

EXPOSE 3000

#####STAGE 2######
FROM nginx:latest

COPY --from=builder /app /app

WORKDIR /app

#RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

CMD [ "node", "server.js", "nginx", "-g", "daemon off;"]

也许我们可以在节点本身安装 Nginx,并在那里复制必要的 Nginx-config?

【问题讨论】:

    标签: node.js nginx dockerfile


    【解决方案1】:

    我找到了另一种方法,以免在每个容器中都安装 nginx,因此决定安装 nginx-ingress-controller k8s

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-03
      • 2019-10-10
      • 1970-01-01
      • 2020-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多