Gitlab CI / CD管道运行问题

时间:2020-03-28 20:12:41

标签: angular docker-compose dockerfile gitlab-ci-runner

嗨,我正在尝试学习持续集成,但是我正面临这个问题。

我已经在服务器上注册了我的跑步者,在gitlab上,我的跑步者从最后40分钟开始运行,然后停止。分享下面的图片。 在本地主机中,我的应用程序运行完美,没有问题。

这是我的Dockerfile:

# base image
FROM node:12.2.0 as build

# install chrome for protractor tests
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt-get update && apt-get install -yq google-chrome-stable

# set working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# install and cache app dependencies
COPY package.json /app/package.json
RUN npm install
RUN npm install -g @angular/cli@7.3.9

# add app
COPY . /app

# # run tests
# RUN ng test --watch=false
# RUN ng e2e --port 4202

# generate build
RUN ng build --output-path=dist

############
### prod ###
############

# base image
FROM nginx:1.16.1-alpine

# copy artifact build from the 'build environment'
COPY --from=build /app/dist /usr/share/nginx/html

# expose port 80
EXPOSE 80

# run nginx
CMD ["nginx", "-g", "daemon off;"]

docker-compose文件

version: '3.7'
services:
  example-prod:
    container_name: angular-app-prod
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - '5001:80'

当我运行docker-compose时,映像正在构建并运行应用程序,没有任何问题。

下面是我的gitlab-ci.yml文件:

DEV-deploy:

  script:
    - docker-compose build --parallel
    - docker-compose up -d

  tags : ['angulardemo']

  only:
    - master

GitLab Runner

Registered GitLab runner

我不知道怎么了。请帮助我

1 个答案:

答案 0 :(得分:0)

多谢,我遇到了亚军的问题: 通过在服务器上安装新的gitlab运行程序,我在服务器上运行了以下命令:

    databaseReference = FirebaseDatabase.getInstance().getReference().child("Users").child(userID).child("Notes");

如果有人可以帮助我解决瓶颈(每次构建时npm包)!这是我的荣幸!