Skip to content

Commit

Permalink
Docker daemon (#15)
Browse files Browse the repository at this point in the history
* CxAnalytixDaemon added docker changes
* CxAnalytixDaemon lowering log level
* Moved out docker file into root
* Adding circle ci changes for the docker
* Update base storage path to be empty to avoid linux specific error on initial run

Co-authored-by: Sergiy Koyev <[email protected]>
Co-authored-by: Ken McDonald <[email protected]>
  • Loading branch information
3 people authored Jul 13, 2020
1 parent 8a4b655 commit 9392131
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 19 deletions.
52 changes: 40 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,44 @@ jobs:
dotnet publish -p:VersionPrefix=${VERSION} --version-suffix ${CIRCLE_BUILD_NUM} -c Release -o artifacts
mkdir tmp
python .circleci/zip.py --output "tmp/CxAnalytix-${VERSION}-${CIRCLE_BUILD_NUM}.zip" --input artifacts
cp Dockerfile tmp/Dockerfile
- persist_to_workspace:
root: tmp
paths:
- ./*

publish-github-release:
docker:
- image: circleci/golang:1.9
steps:
- attach_workspace:
at: tmp
- run:
name: "Publish Release on GitHub"
command: |
go get github.com/tcnksm/ghr
cd tmp
BODY=$(sha256sum *)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -n ${CIRCLE_TAG} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -body "SHA256: ${BODY}" ${CIRCLE_TAG} .
docker:
- image: circleci/golang:1.9
steps:
- attach_workspace:
at: tmp
- run:
name: "Publish Release on GitHub"
command: |
go get github.com/tcnksm/ghr
cd tmp
BODY=$(sha256sum *)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -n ${CIRCLE_TAG} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -body "SHA256: ${BODY}" ${CIRCLE_TAG} .
docker-push:
docker:
- image: docker:18.06.3-ce-git
environment:
DOCKER_REPO: docker.io/checkmarxts/cxanalytix
steps:
- setup_remote_docker
- attach_workspace:
at: tmp
- run:
name: "Publish Images On Dockerhub"
command: |
cd tmp
mv CxAnalytix-*.zip CxAnalytix.zip
unzip CxAnalytix.zip
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} docker.io
docker build -t ${DOCKER_REPO}:${CIRCLE_TAG} -t ${DOCKER_REPO}:${CIRCLE_SHA1} -t ${DOCKER_REPO} .
docker push ${DOCKER_REPO}
workflows:
version: 2
Expand All @@ -61,6 +81,14 @@ workflows:
ignore: /.*/
requires:
- package
- docker-push:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
requires:
- package
ci:
jobs:
# Unit tests need to execute on .net core 3.1, commented until they do
Expand Down
2 changes: 1 addition & 1 deletion CxAnalytixDaemon/CxAnalytixDaemon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>7.1</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion CxAnalytixDaemon/CxAnalytixDaemon.log4net
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@


<root>
<level value="DEBUG" />
<level value="INFO" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
Expand Down
10 changes: 5 additions & 5 deletions CxAnalytixDaemon/dotnet.exe.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</configSections>

<!-- Common config parameters -->
<CxConnection URL="http://localhost"
mnoURL="http://localhost:8080"
<CxConnection URL="%CHECKMARX_URL%"
mnoURL="%CHECKMARX_MNO_URL%"
TimeoutSeconds="600" ValidateCertificates="true" />
<CxCredentials Username="foo" Password ="bar" Token="" />
<CxAnalyticsService ConcurrentThreads="2" StateDataStoragePath=".\"
<CxCredentials Username="%CHECKMARX_USERNAME%" Password ="%CHECKMARX_PASSWORD%" Token="" />
<CxAnalyticsService ConcurrentThreads="2" StateDataStoragePath=""
ProcessPeriodMinutes="120"
OutputFactoryClassPath="CxAnalytix.Out.Log4NetOutput.LoggerOutFactory, Log4NetOutput"
SASTScanSummaryRecordName="RECORD_SAST_Scan_Summary"
Expand All @@ -25,7 +25,7 @@


<!-- Specific output method configuration parameters -->
<CxLogOutput DataRetentionDays="14" OutputRoot="logs\">
<CxLogOutput DataRetentionDays="3" OutputRoot="logs\">
<PurgeSpecs>
<spec MatchSpec="*.log.*" />
</PurgeSpecs>
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY ./ App/
WORKDIR /App
RUN ln -s dotnet.exe.config dotnet.config
ENTRYPOINT ["dotnet", "CxAnalytixDaemon.dll"]

0 comments on commit 9392131

Please sign in to comment.