Browse Source

Merge pull request #140 from abpframework/update-dockerfile

Created new dockerfiles and pipeline for azure devops
pull/141/head
Engincan VESKE 2 years ago
committed by GitHub
parent
commit
9cc068c18d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      etc/azure/Dockerfile.base
  2. 220
      etc/azure/azurepipelines.yml
  3. 14
      etc/k8s/helm-chart/eventhub/values.azure.yaml
  4. 2
      src/EventHub.Admin.HttpApi.Host/Dockerfile
  5. 13
      src/EventHub.Admin.HttpApi.Host/Dockerfile.azure
  6. 10
      src/EventHub.Admin.Web/Dockerfile.azure
  7. 2
      src/EventHub.BackgroundServices/Dockerfile
  8. 13
      src/EventHub.BackgroundServices/Dockerfile.azure
  9. 4
      src/EventHub.DbMigrator/Dockerfile
  10. 11
      src/EventHub.DbMigrator/Dockerfile.azure
  11. 2
      src/EventHub.HttpApi.Host/Dockerfile
  12. 13
      src/EventHub.HttpApi.Host/Dockerfile.azure
  13. 2
      src/EventHub.IdentityServer/Dockerfile
  14. 13
      src/EventHub.IdentityServer/Dockerfile.azure
  15. 2
      src/EventHub.Web/Dockerfile
  16. 13
      src/EventHub.Web/Dockerfile.azure

3
etc/azure/Dockerfile.base

@ -0,0 +1,3 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
COPY . .

220
etc/azure/azurepipelines.yml

@ -0,0 +1,220 @@
trigger:
tags:
include:
- "*.*.*"
resources:
repositories:
- repository: abp-studio
type: github
endpoint: github.com_skoc10
name: volosoft/abp-studio
ref: main
variables:
dockerRegistryServiceConnection: 'volosoft-reg'
tag: $(Build.BuildNumber)
DOCKER_BUILDKIT: 1
pool:
name: aks-deployer-agent
stages:
- stage: Package
displayName: Package
jobs:
- job: Build
displayName: EventHub Build
pool:
name: aks-deployer-agent
steps:
- checkout: self
- checkout: abp-studio
- task: Docker@2
displayName: Build Base Image
inputs:
command: build
repository: eventhub-base
dockerfile: $(Build.SourcesDirectory)/eventhub/etc/azure/Dockerfile.base
buildContext: $(Build.SourcesDirectory)
tags: |
$(tag)
# Build images
- task: Docker@2
displayName: Build DB MIGRATOR
continueOnError: true
inputs:
command: build
repository: eventhub/dbmigrator
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.DbMigrator/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
- task: Docker@2
displayName: Build WEB
continueOnError: true
inputs:
command: build
repository: eventhub/web
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.Web/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
- task: Docker@2
displayName: Build API HOST
continueOnError: true
inputs:
command: build
repository: eventhub/apihost
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.HttpApi.Host/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
- task: Docker@2
displayName: Build ADMIN WEB
continueOnError: true
inputs:
command: build
repository: eventhub/adminweb
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.Admin.Web/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
- task: Docker@2
displayName: Build ADMIN API HOST
continueOnError: true
inputs:
command: build
repository: eventhub/adminapihost
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.Admin.HttpApi.Host/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
- task: Docker@2
displayName: Build IDENTITY SERVER
continueOnError: true
inputs:
command: build
repository: eventhub/identityserver
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.IdentityServer/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
- task: Docker@2
displayName: Build BACKGROUND
continueOnError: true
inputs:
command: build
repository: eventhub/background
dockerfile: $(Build.SourcesDirectory)/eventhub/src/EventHub.BackgroundServices/Dockerfile.azure
buildContext: $(Build.SourcesDirectory)
containerRegistry: $(dockerRegistryServiceConnection)
arguments: "--build-arg=BASE_IMAGE=eventhub-base:$(tag)"
tags: |
$(tag)
# Push images
- task: Docker@2
displayName: Push DB MIGRATOR
continueOnError: true
inputs:
command: push
repository: eventhub/dbmigrator
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: Push WEB
continueOnError: true
inputs:
command: push
repository: eventhub/web
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: Push API HOST
continueOnError: true
inputs:
command: push
repository: eventhub/apihost
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: Push ADMIN WEB
continueOnError: true
inputs:
command: push
repository: eventhub/adminweb
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: Push ADMIN API HOST
continueOnError: true
inputs:
command: push
repository: eventhub/adminapihost
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: Push IDENTITY SERVER
continueOnError: true
inputs:
command: push
repository: eventhub/identityserver
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: Push BACKGROUND
continueOnError: true
inputs:
command: push
repository: eventhub/background
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
# Artifact
- bash: |
sed -i "s/eventHubImageVersion: latest/eventHubImageVersion: \"$(tag)\"/" $(Build.SourcesDirectory)/eventhub/etc/k8s/helm-chart/eventhub/values.azure.yaml
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.SourcesDirectory)/eventhub/etc/k8s/helm-chart/eventhub'
artifact: helm
publishLocation: pipeline

14
etc/k8s/helm-chart/eventhub/values.azure.yaml

@ -21,18 +21,18 @@ global:
imagePullPolicy: Always
eventHubImageVersion: latest
account:
containerImage: "volosoft.azurecr.io/eventhub.account"
containerImage: "volosoft.azurecr.io/eventhub/identityserver"
api:
containerImage: "volosoft.azurecr.io/eventhub.api"
containerImage: "volosoft.azurecr.io/eventhub/apihost"
www:
containerImage: "volosoft.azurecr.io/eventhub.www"
containerImage: "volosoft.azurecr.io/eventhub/web"
admin-api:
containerImage: "volosoft.azurecr.io/eventhub.admin-api"
containerImage: "volosoft.azurecr.io/eventhub/adminapihost"
admin:
containerImage: "volosoft.azurecr.io/eventhub.admin"
containerImage: "volosoft.azurecr.io/eventhub/adminweb"
dbmigrator:
containerImage: "volosoft.azurecr.io/eventhub.dbmigrator"
containerImage: "volosoft.azurecr.io/eventhub/dbmigrator"
background-services:
containerImage: "volosoft.azurecr.io/eventhub.background-services"
containerImage: "volosoft.azurecr.io/eventhub/background"
nodeSelector:
agentpool: demopool

2
src/EventHub.Admin.HttpApi.Host/Dockerfile

@ -1,4 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "EventHub.Admin.HttpApi.Host.dll"]

13
src/EventHub.Admin.HttpApi.Host/Dockerfile.azure

@ -0,0 +1,13 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.Admin.HttpApi.Host
RUN dotnet publish -c Release -o bin/Release/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
COPY --from=base /app/eventhub/src/EventHub.Admin.HttpApi.Host/bin/Release/publish .
ENTRYPOINT ["dotnet", "EventHub.Admin.HttpApi.Host.dll"]

10
src/EventHub.Admin.Web/Dockerfile.azure

@ -0,0 +1,10 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.Admin.Web
RUN dotnet publish -c Release -o bin/Release/publish
FROM nginx:latest AS publish
COPY --from=base /app/eventhub/src/EventHub.Admin.Web/bin/Release/publish/wwwroot/ /usr/share/nginx/html/
COPY --from=base /app/eventhub/src/EventHub.Admin.Web/nginx.conf /etc/nginx/conf.d/default.conf

2
src/EventHub.BackgroundServices/Dockerfile

@ -1,4 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/ app/
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "EventHub.BackgroundServices.dll"]

13
src/EventHub.BackgroundServices/Dockerfile.azure

@ -0,0 +1,13 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.BackgroundServices
RUN dotnet publish -c Release -o bin/Release/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
COPY --from=base /app/eventhub/src/EventHub.BackgroundServices/bin/Release/publish .
ENTRYPOINT ["dotnet", "EventHub.BackgroundServices.dll"]

4
src/EventHub.DbMigrator/Dockerfile

@ -1,4 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy
COPY bin/Release/net8.0/ app/
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "EventHub.DbMigrator.dll"]

11
src/EventHub.DbMigrator/Dockerfile.azure

@ -0,0 +1,11 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.DbMigrator
RUN dotnet publish -c Release -o bin/Release/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
WORKDIR /app
COPY --from=base /app/eventhub/src/EventHub.DbMigrator/bin/Release/publish .
ENTRYPOINT ["dotnet", "EventHub.DbMigrator.dll"]

2
src/EventHub.HttpApi.Host/Dockerfile

@ -1,4 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "EventHub.HttpApi.Host.dll"]

13
src/EventHub.HttpApi.Host/Dockerfile.azure

@ -0,0 +1,13 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.HttpApi.Host
RUN dotnet publish -c Release -o bin/Release/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
COPY --from=base /app/eventhub/src/EventHub.HttpApi.Host/bin/Release/publish .
ENTRYPOINT ["dotnet", "EventHub.HttpApi.Host.dll"]

2
src/EventHub.IdentityServer/Dockerfile

@ -1,4 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "EventHub.IdentityServer.dll"]

13
src/EventHub.IdentityServer/Dockerfile.azure

@ -0,0 +1,13 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.IdentityServer
RUN dotnet publish -c Release -o bin/Release/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
COPY --from=base /app/eventhub/src/EventHub.IdentityServer/bin/Release/publish .
ENTRYPOINT ["dotnet", "EventHub.IdentityServer.dll"]

2
src/EventHub.Web/Dockerfile

@ -1,4 +1,6 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY bin/Release/net8.0/publish/ app/
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENTRYPOINT ["dotnet", "EventHub.Web.dll"]

13
src/EventHub.Web/Dockerfile.azure

@ -0,0 +1,13 @@
ARG BASE_IMAGE=base
FROM ${BASE_IMAGE} AS base
WORKDIR /app/eventhub/src/EventHub.Web
RUN dotnet publish -c Release -o bin/Release/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
COPY --from=base /app/eventhub/src/EventHub.Web/bin/Release/publish .
ENTRYPOINT ["dotnet", "EventHub.Web.dll"]
Loading…
Cancel
Save