当前位置:   article > 正文

自动化构建:gitlab gitlab-run ,maven的缓存 和 gitea drone drone-run_gitea怎么添加缓存

gitea怎么添加缓存
  1. #Started.gitlab-ci.yml
  2. stages: # List of stages for jobs, and their order of execution
  3. - build
  4. maven-build:
  5. when: manual
  6. stage: build
  7. image: maven:3.6.3-jdk-8
  8. script:
  9. - mvn -Dmaven.test.skip=true -P dev clean package
  10. - cp target/*.jar /app/build #这里是maven:3.6.3-jdk-8容器文件夹
  11. artifacts:
  12. paths:
  13. - target/*.jar
  14. #docker-run 配置
  15. # [[runners]]
  16. # name = "docker-runner"
  17. # url = "http://192.168.241.128:6080/"
  18. # token = "KLfUs5WySxrNozxmTddF"
  19. # executor = "docker"
  20. # [runners.custom_build_dir]
  21. # [runners.cache]
  22. # [runners.cache.s3]
  23. # [runners.cache.gcs]
  24. # [runners.cache.azure]
  25. # [runners.docker]
  26. # tls_verify = false
  27. # image = "alpine:latest"
  28. # pull_policy = "if-not-present"
  29. # privileged = false
  30. # disable_entrypoint_overwrite = false
  31. # oom_kill_disable = false
  32. # disable_cache = false
  33. # volumes = ["/cache","/data/qqq-gitlab/maven:/root/.m2","/data/qqq-gitlab/builds:/app/build"] 关键这里挂在目录配置
  34. # shm_size = 0

这里是    gitea drone 文件名.dron.yml

  1. kind: pipeline
  2. type: docker
  3. name: default
  4. steps:
  5. - name: build-package # 流水线名称
  6. image: maven:3.8-openjdk-8 # 定义创建容器的Docker镜像
  7. volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
  8. - name: maven-cache
  9. path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
  10. - name: maven-build
  11. path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
  12. commands:
  13. - mvn -Dmaven.test.skip=true -P dev clean package
  14. - cp target/*.jar /app/build/*.jar
  15. volumes: # 定义流水线挂载目录,用于共享数据
  16. - name: maven-build
  17. host:
  18. path: /data/app/maven/build # 从宿主机中挂载的目录
  19. - name: maven-cache
  20. host:
  21. path: /data/app/maven/cache

总结:用到 image: maven:3.8-openjdk-8镜像构建的,代码和编译后代码都在此容器中,所以要通过配置映射到宿主机中好操作!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/130594
推荐阅读
相关标签
  

闽ICP备14008679号