Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add task manager dockerfile #309

Merged
merged 5 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,44 @@ jobs:
export VERSION=`cat VERSION`
./build.sh
docker tag monai/workflow-manager:$VERSION monai/workflow-manager:${{ github.sha }}
docker tag monai/task-manager:$VERSION monai/task-manager:${{ github.sha }}

- name: Scan image with Azure Container Scan
- name: Scan Workflow Manager image with Azure Container Scan
uses: Azure/container-scan@v0
with:
image-name: monai/workflow-manager:${{ github.sha }}

- name: Scan image with Anchore
id: scan
- name: Scan Task Manager image with Azure Container Scan
uses: Azure/container-scan@v0
with:
image-name: monai/task-manager:${{ github.sha }}

- name: Scan Workflow Manager image with Anchore
id: scan-workflow-manager
uses: anchore/scan-action@v2
with:
image: monai/workflow-manager:${{ github.sha }}
fail-build: true
severity-cutoff: high
acs-report-enable: true

- name: upload Anchore scan SARIF report
- name: upload Workflow Manager Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ${{ steps.scan-workflow-manager.outputs.sarif }}
category: workflow-manager

- name: Scan Task Manager image with Anchore
id: scan-task-manager
uses: anchore/scan-action@v2
with:
image: monai/task-manager:${{ github.sha }}
fail-build: true
severity-cutoff: high
acs-report-enable: true

- name: upload Task Manager Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
sarif_file: ${{ steps.scan-task-manager.outputs.sarif }}
category: task-manager
60 changes: 60 additions & 0 deletions TaskManager.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM mcr.microsoft.com/dotnet/sdk:6.0-focal as build

ARG Version=0.0.0
ARG FileVersion=0.0.0.0

# Install the tools
RUN dotnet tool install --tool-path /tools dotnet-trace
RUN dotnet tool install --tool-path /tools dotnet-dump
RUN dotnet tool install --tool-path /tools dotnet-counters
RUN dotnet tool install --tool-path /tools dotnet-stack
WORKDIR /app
COPY . ./

RUN echo "Building MONAI Workflow Manager $Version ($FileVersion)..."
RUN dotnet publish -c Release -o out --nologo /p:Version=$Version /p:FileVersion=$FileVersion src/TaskManager/TaskManager/Monai.Deploy.WorkflowManager.TaskManager.csproj

RUN echo "Fetching mc executable for minio..."
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc
RUN chmod +x mc

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libssl1.1 \
openssl \
sqlite3 \
&& rm -rf /var/lib/apt/lists

WORKDIR /opt/monai/wm
COPY --from=build /app/out .
#COPY docs/compliance/open-source-licenses.md .

COPY --from=build /tools /opt/dotnetcore-tools

COPY --from=build /app/mc /usr/local/bin/mc
# RUN mv mc /usr/local/bin/mc

EXPOSE 104
EXPOSE 5000

RUN ls -lR /opt/monai/wm
ENV PATH="/opt/dotnetcore-tools:${PATH}"

ENTRYPOINT ["/opt/monai/wm/Monai.Deploy.WorkflowManager"]
120 changes: 60 additions & 60 deletions Dockerfile → WorkflowManager.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
# Copyright 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal as build
ARG Version=0.0.0
ARG FileVersion=0.0.0.0
# Install the tools
RUN dotnet tool install --tool-path /tools dotnet-trace
RUN dotnet tool install --tool-path /tools dotnet-dump
RUN dotnet tool install --tool-path /tools dotnet-counters
RUN dotnet tool install --tool-path /tools dotnet-stack
WORKDIR /app
COPY . ./
RUN echo "Building MONAI Workflow Manager $Version ($FileVersion)..."
RUN dotnet publish -c Release -o out --nologo /p:Version=$Version /p:FileVersion=$FileVersion src/WorkflowManager/WorkflowManager/Monai.Deploy.WorkflowManager.csproj
RUN echo "Fetching mc executable for minio..."
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc
RUN chmod +x mc
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libssl1.1 \
openssl \
sqlite3 \
&& rm -rf /var/lib/apt/lists
WORKDIR /opt/monai/wm
COPY --from=build /app/out .
#COPY docs/compliance/open-source-licenses.md .
COPY --from=build /tools /opt/dotnetcore-tools
COPY --from=build /app/mc /usr/local/bin/mc
# RUN mv mc /usr/local/bin/mc
EXPOSE 104
EXPOSE 5000
RUN ls -lR /opt/monai/wm
ENV PATH="/opt/dotnetcore-tools:${PATH}"
ENTRYPOINT ["/opt/monai/wm/Monai.Deploy.WorkflowManager"]
# Copyright 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM mcr.microsoft.com/dotnet/sdk:6.0-focal as build

ARG Version=0.0.0
ARG FileVersion=0.0.0.0

# Install the tools
RUN dotnet tool install --tool-path /tools dotnet-trace
RUN dotnet tool install --tool-path /tools dotnet-dump
RUN dotnet tool install --tool-path /tools dotnet-counters
RUN dotnet tool install --tool-path /tools dotnet-stack
WORKDIR /app
COPY . ./

RUN echo "Building MONAI Workflow Manager $Version ($FileVersion)..."
RUN dotnet publish -c Release -o out --nologo /p:Version=$Version /p:FileVersion=$FileVersion src/WorkflowManager/WorkflowManager/Monai.Deploy.WorkflowManager.csproj

RUN echo "Fetching mc executable for minio..."
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc
RUN chmod +x mc

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libssl1.1 \
openssl \
sqlite3 \
&& rm -rf /var/lib/apt/lists

WORKDIR /opt/monai/wm
COPY --from=build /app/out .
#COPY docs/compliance/open-source-licenses.md .

COPY --from=build /tools /opt/dotnetcore-tools

COPY --from=build /app/mc /usr/local/bin/mc
# RUN mv mc /usr/local/bin/mc

EXPOSE 104
EXPOSE 5000

RUN ls -lR /opt/monai/wm
ENV PATH="/opt/dotnetcore-tools:${PATH}"

ENTRYPOINT ["/opt/monai/wm/Monai.Deploy.WorkflowManager"]
7 changes: 6 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ fi

echo "Building Workflow Manager Docker Image. VERSION=$VERSION, FILEVERSION=$FILEVERSION"
pushd $SCRIPT_DIR
docker build --tag monai/workflow-manager:$VERSION --build-arg Version=$VERSION --build-arg FileVersion=$FILEVERSION .
docker build --tag monai/workflow-manager:$VERSION -f ./WorkflowManager.Dockerfile --build-arg Version=$VERSION --build-arg FileVersion=$FILEVERSION .
popd

echo "Building Task Manager Docker Image. VERSION=$VERSION, FILEVERSION=$FILEVERSION"
pushd $SCRIPT_DIR
docker build --tag monai/task-manager:$VERSION -f ./TaskManager.Dockerfile --build-arg Version=$VERSION --build-arg FileVersion=$FILEVERSION .
popd