我已经创建了一个运行Angular项目的Docker容器,现在我试图在容器内运行我的单元测试,但一直不成功。我需要一个无头浏览器来运行我的测试,而PhantomJS对我来说太多问题了,而且与Chrome运行测试时结果不同。
以下是我的Dockerfile:
# download (or use if it's in cache) the latest official image from node
FROM node:latest
# create directory in the container and set all privileges
RUN mkdir -p /usr/src/app && chmod 777 /usr/src/app
# make the directory available for following commands
WORKDIR /usr/src/app
# copy all local's frontend content to the WORKDIR
COPY . /usr/src/app
# Expose the port the app runs in
EXPOSE 4200
CMD ["npm", "start"]
我尝试使用无头Chrome,但仍需要一些我不知道如何配置的内容。有没有人有任何想法?