Skip to content

Commit 0970eff

Browse files
authored
Merge pull request #910 from microsoft/feature/docker-image
- adds docker image definition for hidi
2 parents c0aca71 + 8bee807 commit 0970eff

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/docker.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Docker image
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [master, vnext]
6+
paths: ['src/Microsoft.OpenApi.Hidi/**', '.github/workflows/**']
7+
env:
8+
REGISTRY: msgraphprod.azurecr.io
9+
IMAGE_NAME: public/hidi
10+
jobs:
11+
push_to_registry:
12+
environment:
13+
name: acr
14+
name: Push Docker image
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@v3
19+
- name: Login to GitHub package feed
20+
uses: docker/[email protected]
21+
with:
22+
username: ${{ secrets.ACR_USERNAME }}
23+
password: ${{ secrets.ACR_PASSWORD }}
24+
registry: ${{ env.REGISTRY }}
25+
- run: |
26+
$content = [XML](Get-Content ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)
27+
$version = $content.Project.PropertyGroup.Version
28+
echo "::set-output name=version::${version}"
29+
shell: pwsh
30+
id: getversion
31+
if: contains(github.ref, 'refs/tags/v')
32+
env:
33+
BRANCH_NAME: ${{ github.ref }}
34+
- name: Push to GitHub Packages - Nightly
35+
if: contains(github.ref, 'refs/head/vnext')
36+
uses: docker/[email protected]
37+
with:
38+
push: true
39+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
40+
- name: Push to GitHub Packages - Release
41+
if: contains(github.ref, 'refs/head/master')
42+
uses: docker/[email protected]
43+
with:
44+
push: true
45+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
2+
WORKDIR /app
3+
4+
COPY ./src ./hidi/src
5+
WORKDIR /app/hidi
6+
RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release
7+
8+
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime
9+
WORKDIR /app
10+
11+
COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net6.0 ./
12+
13+
VOLUME /app/output
14+
VOLUME /app/openapi.yml
15+
VOLUME /app/api.csdl
16+
VOLUME /app/collection.json
17+
ENV HIDI_CONTAINER=true DOTNET_TieredPGO=1 DOTNET_TC_QuickJitForLoops=1
18+
ENTRYPOINT ["dotnet", "Microsoft.OpenApi.Hidi.dll"]
19+
LABEL description="# Welcome to Hidi \
20+
To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET/tree/vnext/src/Microsoft.OpenApi.Hidi) \
21+
[Source dockerfile](https://github.com/microsoft/OpenAPI.NET/blob/vnext/Dockerfile)"

0 commit comments

Comments
 (0)