Skip to content

Commit

Permalink
Merge pull request #134 from CSCfi/CSCTTV-3856-interface-rahti2-config
Browse files Browse the repository at this point in the history
CSTTV-3856 interface Rahti2 config
  • Loading branch information
sarkikos authored May 16, 2024
2 parents e75c635 + 5d1fb51 commit 702dcc3
Show file tree
Hide file tree
Showing 4 changed files with 358 additions and 0 deletions.
28 changes: 28 additions & 0 deletions aspnetcore/openshift/api/rahti2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Builder
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /build

# Copy csproj and restore as distinct layers
COPY ["packages","./packages"]
COPY ["aspnetcore/nuget.config","./Interface/nuget.config"]
COPY ["aspnetcore/src/Interface/Interface.csproj","./Interface/Interface.csproj"]
COPY ["aspnetcore/src/ElasticService/ElasticService.csproj","./ElasticService/ElasticService.csproj"]
COPY ["aspnetcore/src/Service.Models/Service.Models.csproj","./Service.Models/Service.Models.csproj"]
COPY ["aspnetcore/src/ApiModels/ApiModels.csproj","./ApiModels/ApiModels.csproj"]
COPY ["aspnetcore/src/Logging/Logging.csproj","./Logging/Logging.csproj"]
RUN dotnet restore "Interface/Interface.csproj"

# Copy everything else and build
COPY ["aspnetcore/src/Interface/","./Interface"]
COPY ["aspnetcore/src/ElasticService/","./ElasticService"]
COPY ["aspnetcore/src/Service.Models/","./Service.Models"]
COPY ["aspnetcore/src/ApiModels/","./ApiModels"]
COPY ["aspnetcore/src/Logging/","./Logging"]
RUN dotnet publish "Interface/Interface.csproj" -c Release -o out

# Runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /build/out .
EXPOSE 8080
ENTRYPOINT ["dotnet", "CSC.PublicApi.Interface.dll"]
110 changes: 110 additions & 0 deletions aspnetcore/openshift/api/rahti2/template-api-devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-api-devel
template: publicapi-api-devel
name: publicapi-api-devel
annotations:
description: "Public API devel"
iconClass: icon-dotnet
objects:

# Service
- apiVersion: v1
kind: Service
metadata:
name: publicapi-api-devel
labels:
app: publicapi-api-devel
annotations:
description: Public API devel
spec:
ports:
- name: dotnet
port: 8080
targetPort: 8080
selector:
app: publicapi-api-devel

# ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: publicapi-api-devel
labels:
app: publicapi-api-devel

# BuildConfig using Docker build strategy
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: publicapi-api-build-devel
labels:
app: publicapi-api-devel
spec:
source:
git:
uri: https://github.com/CSCfi/research-fi-publicapi.git
ref: devel
contextDir: .
strategy:
type: Docker
dockerStrategy:
dockerfilePath: aspnetcore/openshift/api/rahti2/Dockerfile
output:
to:
kind: ImageStreamTag
name: publicapi-api-devel:latest
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2

# Deployment config
- apiVersion: apps/v1
kind: Deployment
metadata:
name: publicapi-api-devel
labels:
app: publicapi-api-devel
spec:
selector:
matchLabels:
app: publicapi-api-devel
template:
metadata:
labels:
app: publicapi-api-devel
spec:
containers:
- name: publicapi-api-container-devel
image: image-registry.openshift-image-registry.svc:5000/researchfi-devel/publicapi-api-devel:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 250m
memory: 256Mi
requests:
cpu: 50m
memory: 128Mi
replicas: 1
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- publicapi-api-container-devel
from:
kind: ImageStreamTag
name: publicapi-api-devel:latest
strategy:
type: RollingUpdate
110 changes: 110 additions & 0 deletions aspnetcore/openshift/api/rahti2/template-api-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-api-production
template: publicapi-api-production
name: publicapi-api-production
annotations:
description: "Public API production"
iconClass: icon-dotnet
objects:

# Service
- apiVersion: v1
kind: Service
metadata:
name: publicapi-api-production
labels:
app: publicapi-api-production
annotations:
description: Public API production
spec:
ports:
- name: dotnet
port: 8080
targetPort: 8080
selector:
app: publicapi-api-production

# ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: publicapi-api-production
labels:
app: publicapi-api-production

# BuildConfig using Docker build strategy
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: publicapi-api-build-production
labels:
app: publicapi-api-production
spec:
source:
git:
uri: https://github.com/CSCfi/research-fi-publicapi.git
ref: main
contextDir: .
strategy:
type: Docker
dockerStrategy:
dockerfilePath: aspnetcore/openshift/api/rahti2/Dockerfile
output:
to:
kind: ImageStreamTag
name: publicapi-api-production:latest
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2

# Deployment config
- apiVersion: apps/v1
kind: Deployment
metadata:
name: publicapi-api-production
labels:
app: publicapi-api-production
spec:
selector:
matchLabels:
app: publicapi-api-production
template:
metadata:
labels:
app: publicapi-api-production
spec:
containers:
- name: publicapi-api-container-production
image: image-registry.openshift-image-registry.svc:5000/researchfi-production/publicapi-api-production:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 256Mi
replicas: 1
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- publicapi-api-container-production
from:
kind: ImageStreamTag
name: publicapi-api-production:latest
strategy:
type: RollingUpdate
110 changes: 110 additions & 0 deletions aspnetcore/openshift/api/rahti2/template-api-qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-api-qa
template: publicapi-api-qa
name: publicapi-api-qa
annotations:
description: "Public API QA"
iconClass: icon-dotnet
objects:

# Service
- apiVersion: v1
kind: Service
metadata:
name: publicapi-api-qa
labels:
app: publicapi-api-qa
annotations:
description: Public API QA
spec:
ports:
- name: dotnet
port: 8080
targetPort: 8080
selector:
app: publicapi-api-qa

# ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: publicapi-api-qa
labels:
app: publicapi-api-qa

# BuildConfig using Docker build strategy
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: publicapi-api-build-qa
labels:
app: publicapi-api-qa
spec:
source:
git:
uri: https://github.com/CSCfi/research-fi-publicapi.git
ref: qa
contextDir: .
strategy:
type: Docker
dockerStrategy:
dockerfilePath: aspnetcore/openshift/api/rahti2/Dockerfile
output:
to:
kind: ImageStreamTag
name: publicapi-api-qa:latest
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2

# Deployment config
- apiVersion: apps/v1
kind: Deployment
metadata:
name: publicapi-api-qa
labels:
app: publicapi-api-qa
spec:
selector:
matchLabels:
app: publicapi-api-qa
template:
metadata:
labels:
app: publicapi-api-qa
spec:
containers:
- name: publicapi-api-container-qa
image: image-registry.openshift-image-registry.svc:5000/researchfi-qa/publicapi-api-qa:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 256Mi
replicas: 1
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- publicapi-api-container-qa
from:
kind: ImageStreamTag
name: publicapi-api-qa:latest
strategy:
type: RollingUpdate

0 comments on commit 702dcc3

Please sign in to comment.