图像未加载到Dockerized /容器化MEAN应用程序中

时间:2018-07-14 05:15:14

标签: docker dockerfile mean-stack

我已经对我的MEAN Stack应用程序进行了容器化,一旦完成使用DockerFile即可。我已经创建了一个容器并在浏览器中启动了服务器,应用程序正在完美加载,我能够使用我的整个应用程序,但应用程序中的图像未加载。以下是我的Docker文件

如果您想知道我的文件结构如何,我正在使用MEAN JS样板

我没有使用任何Docker Compose,因为我正在使用用于数据库的云数据库API,我正在使用angularJS,所以没有前端服务器。我只有一台服务器,它是节点JS。因此,我使用了使用docker文件的一般docker容器创建方法。

# Build:
# docker build -t meanjs/mean .
#
# Run:
# docker run -it meanjs/mean
#
# Compose:
# docker-compose up -d

FROM node:carbon
#MAINTAINER MEAN.JS

# 80 = HTTP, 443 = HTTPS, 3000 = MEAN.JS server, 35729 = livereload, 8080 = node-inspector
EXPOSE 80 443 3001 35729 8080

# Set development environment as default
ENV NODE_ENV development

# Install Utilities
RUN apt-get update -q  \
&& apt-get install -yqq \
curl \
git \
ssh \
gcc \
make \
build-essential \
libkrb5-dev \
sudo \
apt-utils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ */tmp/* /var/tmp/*

# Install nodejs
RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
RUN sudo apt-get install -yq nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ */tmp/* /var/tmp/*

# Install MEAN.JS Prerequisites
RUN npm install --quiet -g gulp bower yo mocha karma-cli pm2 
RUN npm install npm cache clean

RUN mkdir -p /opt/mean.js/public/lib
WORKDIR /opt/mean.js

# Copies the local package.json file to the container
# and utilities docker container cache to not needing to rebuild
# and install node_modules/ everytime we build the docker, but only
# when the local package.json file changes.
# Install npm packages
COPY package.json /opt/mean.js/package.json
RUN npm install --quiet
# RUN npm cache clean

# Install bower packages
COPY bower.json /opt/mean.js/bower.json
COPY .bowerrc /opt/mean.js/.bowerrc
RUN bower install --quiet --allow-root --config.interactive=false

COPY . /opt/mean.js

# Run MEAN.JS server
CMD npm install && npm start

0 个答案:

没有答案
相关问题