首页 > 其他分享 >Gitlab CI + Dotnet6

Gitlab CI + Dotnet6

时间:2023-05-03 21:44:49浏览次数:39  
标签:CI Gitlab NAME Dotnet6 PUBLISH dotnet build DIRECTORY docker

1.Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
EXPOSE 80
EXPOSE 443
COPY /app/publish .
ENTRYPOINT ["dotnet", "coreqi_api.dll"]
2.[.gitlab-ci.yml]
stages:
  - build-project
  - build-docker
  - deploy

variables:
  PROJECT_NAME: 'coreqi-api'
  NUGET_PACKAGES_DIRECTORY: '.nuget'
  #BUILD_DIRECTORY: 'app/build'
  PUBLISH_DIRECTORY: 'app/publish'
  TAG: fanqi/coreqi-api:latest
  
cache:
  key: "dotnet-bin-cache"
  paths:
    - '$NUGET_PACKAGES_DIRECTORY'
    #- '$BUILD_DIRECTORY'
    - '$PUBLISH_DIRECTORY'
  policy: pull-push
  
before_script:
  - export IMAGE_FULL_NAME=fanqi/coreqi-api:latest
  - export PROJECT_NAME=coreqi-api

build-project:
  image: mcr.microsoft.com/dotnet/sdk:6.0
  stage: build-project
  cache:
    key: "dotnet-bin-cache"
    paths:
      - '$NUGET_PACKAGES_DIRECTORY'
      #- '$BUILD_DIRECTORY'
      - '$PUBLISH_DIRECTORY'
    policy: push
  tags:
    - docker
  script:
    - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
    #- 'dotnet build --no-restore -c Release -o $BUILD_DIRECTORY'
    - 'dotnet publish -c Release -o $PUBLISH_DIRECTORY /p:UseAppHost=false'
    - 'ls $PUBLISH_DIRECTORY'
    - 'echo dotnet build success'
  artifacts:
    name: 'coreqi-api'
    paths:
      - $PUBLISH_DIRECTORY
    expire_in: 1 week
     
build-docker:
  image: docker:stable
  stage: build-docker
  cache:
    key: "dotnet-bin-cache"
    paths:
      - '$PUBLISH_DIRECTORY'
    policy: pull
  tags:
    - docker
  script:
    - 'docker build -t $IMAGE_FULL_NAME .'
  only:
    - main

# tests:
  # stage: test
  # script:
    # - 'dotnet test --no-restore'

deploy:
  image: docker:stable
  stage: deploy
  tags:
    - docker
  script:
    - CONTAINER_NAME=$(docker ps -aq --filter name=$PROJECT_NAME)
    - echo $CONTAINER_NAME
    - if [[ -n "$CONTAINER_NAME" ]]; then
      docker rm -f $CONTAINER_NAME;
      fi
    - docker run -d --name $PROJECT_NAME -p 10010:80 $IMAGE_FULL_NAME
  only:
    - main

标签:CI,Gitlab,NAME,Dotnet6,PUBLISH,dotnet,build,DIRECTORY,docker
From: https://www.cnblogs.com/fanqisoft/p/17369739.html

相关文章

  • 2022CVPR_Toward Fast, Flexible, and Robust Low-Light Image Enhancement(SCI_main)
    1.motivation(1)低光增强不能处理复杂的场景(2)需要耗费大量的计算2.contribution(1)节省计算(2)发明了自监督的SCI模块(SCI的核心是引入额外的网络模块(自校准照明)来辅助训练,而不是用于测试)大佬链接:(11条消息)低照度增强--论文阅读【《TowardFast,Flexible,andRobustLow-Light......
  • 论文解读《Interpolated Adversarial Training: Achieving robust neural networks wi
    论文信息论文标题:InterpolatedAdversarialTraining:Achievingrobustneuralnetworkswithoutsacrificingtoomuchaccuracy论文作者:AlexLambVikasVermaKenjiKawaguchiAlexanderMatyaskoSavyaKhoslaJuhoKannalaYoshuaBengio论文来源:2022NeuralNetworks论文地址:dow......
  • 两篇Science文章揭示癌症治疗中细胞感应氧气的新机制
    奥卢大学和哈佛大学的研究人员发现了当前未知的新机制,身体细胞通过该机制感应氧气。缺氧对基因的功能有直接影响,并抑制细胞分化。 该研究发表在Science杂志,其将为癌症药物的开发开辟新的机会。 该发现的核心是组蛋白去甲基化酶,其任务是调控染色质的结构。研究人员证明,缺氧会抑制......
  • 06 Real-Time Ray-Tracing
    1.Tempora1SPP包含如下四条光线。但是一个像素只用1spp会噪声很严重。因此RTRT的主要目的是降噪,即滤波。1.1时间复用TemporaG-Buffer几何缓冲区:记录屏幕空间的信息;在光栅化的时候顺便得到。BackProjection首先,拿到当前帧像素的世界坐标,可以从G-buffer中拿到,否......
  • cout cin
    cinistream类,定在文件为iostream头文件,为以下数据类型重载了>>抽取操作符,所重载的函数称为格式化输入函数。signedchar&、unsignedchar&、char&、short&、unsignedshort&、int&、unsignedint&、long&、unsignedlong&、longlong&(C++11)、unsignedlonglong......
  • Gogs 推送 URL 被解析到默认禁用的本地网络地址(Payload URL resolved to a local netw
    原帖地址:https://blog.51cto.com/u_1472521/5981347问题配置Web钩子使用本地URL出现错误。  解决方法修改​​app.ini​​​配置文件,添加参数​​LOCAL_NETWORK_ALLOWLIST​​后重启服务。如果是多个用逗号分开,例如:LOCAL_NETWORK_ALLOWLIST=drone,192.168.20.1......
  • 2023 Hubei Provincial Collegiate Programming Contest题解 C F H I J K M
    补题链接:https://codeforces.com/gym/104337原文链接:https://www.eriktse.com/algorithm/1136.htmlM.DifferentBilling签到题,写几个柿子然后枚举B或C即可。#include<bits/stdc++.h>#defineintlonglongusingnamespacestd;signedmain(){ ios::sync_with_stdio(......
  • 2023 Hubei Provincial Collegiate Programming Contest
    链接:https://codeforces.com/gym/104337C画个图看看,复杂度\(O(1)\)。C++Code#include"bits/stdc++.h"usingnamespacestd;usingi64=longlong;intmain(){ios::sync_with_stdio(false);cin.tie(nullptr);intn,m;cin>>......
  • VMIACC-5595-208反射内存交换机 GE反射内存卡 PCI-5565 VMIC-5565 反射内存
    VMIACC-5595-208ACC5595集线器5595系列网络集线器,是反射内存网络数据交互的核心。1 到 8 口可配置。可插拔收发器支持单模或者多模模式。1x8 口或者 2x4 口。可以通过串口了解状态进行控制。产品简介vmic5565反射内存实时网络传输系统是基于环型或星型的,高速复制的共享内......
  • 【npm】创建私有npm包,使用Verdaccio
    1、npm官网可以创建私有npm包,但是要收费,每人每月7$,先找免费的2、在线的免费的有GitHub,可以看文章:https://andreybleme.com/2020-05-31/hosting-private-npm-packages-for-free/3、自己本地搭建仓库,可以使用开源项目 verdaccio,这个项目的前身是 sinopia,前身已经不维护了,verdaccio......