小编How*_*ins的帖子

如何使用 Gitlab CI 在跨两个阶段的工作期间保持 docker 镜像构建?

我在 EC2 上使用 Gitlab 运行程序build,在 ECS 上test使用docker 映像。deploy

我使用“推/拉”逻辑开始我的 CI 工作流程:我在第一阶段构建所有 docker 映像并将它们推送到我的 gitlab 存储库,然后在该阶段拉它们test

我认为通过保持阶段之间构建的图像可以大大缩短工作流程build时间。buildtest

我的gitlab-ci.yml看起来像这样:

stages:
  - build
  - test
  - deploy

build_backend:
  stage: build
  image: docker
  services:
    - docker:dind
  before_script:
    - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
  script:
    - docker build -t backend:$CI_COMMIT_BRANCH ./backend
  only:
    refs:
      - develop
      - master

build_generator:
  stage: build
  image: docker
  services:
    - docker:dind
  before_script:
    - echo …
Run Code Online (Sandbox Code Playgroud)

docker gitlab-ci gitlab-ci-runner docker-compose

10
推荐指数
1
解决办法
1万
查看次数

在 ecs fargate 上使用 docker dind 和 GitLab runner

我在 EC2 上设置了一个 GitLab 运行程序,它会触发 Fargate ECS 集群上的作业。我一步步遵循本教程:https ://docs.gitlab.com/runner/configuration/runner_autoscale_aws_fargate

在 CI/CD 期间,我构建了 docker 映像,然后我想在 CI/CD 的其他阶段重用它们。所以当我使用共享运行器时,我使用了 docker dind:

  image: docker:stable
  services:
    - docker:dind
Run Code Online (Sandbox Code Playgroud)

我的config.toml看起来像这样:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "fargate-runner"
  url = "https://gitlab.com/"
  token = "KRGVsYCF-V-D1u7UvCjq"
  executor = "custom"
  builds_dir = "/opt/gitlab-runner/builds"
  cache_dir = "/opt/gitlab-runner/cache"
  [runners.custom]
    config_exec = "/opt/gitlab-runner/fargate"
    config_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "config"]
    prepare_exec = "/opt/gitlab-runner/fargate"
    prepare_args = ["--config", "/etc/gitlab-runner/fargate.toml", "custom", "prepare"]
    run_exec = "/opt/gitlab-runner/fargate"
    run_args = …
Run Code Online (Sandbox Code Playgroud)

gitlab docker gitlab-ci gitlab-ci-runner aws-fargate

5
推荐指数
1
解决办法
2104
查看次数

错误:找不到模块“@vue/cli-plugin-babel/preset”

Error: Cannot find module '@vue/cli-plugin-babel/preset'当我使用 docker-compose 运行 Cypress 测试时遇到此错误。

docker-compose.yml

  frontend:
    container_name: VueJS
    build: client
    volumes:
      - ./client:/app #Uncomment to directly update code in the container
      - /app/node_modules
#    environment:
#      - CHOKIDAR_USEPOLLING=true
    networks:
      default:
    ports:
      - "8080:8080"

  cypress:
   container_name: Cypress
   image: cypress/included:7.5.0
#   entrypoint: cypress open --project /e2e
   environment:
     # pass base url to test pointing at the web application
     - CYPRESS_baseUrl=http://frontend:8080
   # share the current folder as volume to avoid copying
   working_dir: /e2e
   volumes:
     - ./client:/e2e
# …
Run Code Online (Sandbox Code Playgroud)

typescript docker vue.js docker-compose cypress

3
推荐指数
1
解决办法
1万
查看次数