Browse Source

Rework to support network share

Vadim Surkov 6 years ago
parent
commit
8bfc91b5dc
3 changed files with 21 additions and 17 deletions
  1. 4 3
      Dockerfile
  2. 2 2
      analis-default.conf
  3. 15 12
      entrypoint.ps1

+ 4 - 3
Dockerfile

@@ -3,6 +3,7 @@ FROM microsoft/windowsservercore:10.0.14393.2724
 
 RUN reg add "HKCU\Control Panel\International" /F /V sShortDate /T REG_SZ /D dd.MM.yyyy
 RUN mkdir c:\Services\Analis
-COPY Infoclinica analis.conf infodent.ini entrypoint.ps1 c:/Services/Analis/
-#ENTRYPOINT ["powershell.exe","c:/Services/Analis/entrypoint.ps1"]
-ENTRYPOINT C:\\Services\\Analis\\AnalisServer.exe
+COPY Infoclinica c:/Services/Analis/
+COPY analis-default.conf infodent.ini entrypoint.ps1 c:/Services/Analis/
+ENTRYPOINT ["powershell.exe","c:/Services/Analis/entrypoint.ps1"]
+#ENTRYPOINT C:\\Services\\Analis\\AnalisServer.exe

+ 2 - 2
analis.conf → analis-default.conf

@@ -1,5 +1,5 @@
-LogPath=C:\Services\Files\Log
-a=dev_lab
+LogPath=C:\Services\Analis\Log
+a=prod_lab
 Uid=990010000000001
 AnalisInterval=0
 LabExchangeInterval=0

+ 15 - 12
entrypoint.ps1

@@ -1,9 +1,5 @@
 #Set-PSDebug -Trace 1
 
-if (!$env:serviceshare) {
-    write-host "ServiceShare must be defined"
-    exit 1
-}
 if (!$env:logshare) {
     write-host "LogShare must be defined"
     exit 1
@@ -20,25 +16,32 @@ if (!$env:filespath) {
 if ( (test-path("C:\ProgramData\Docker\secrets\shares.username")) -And (test-path("C:\ProgramData\Docker\secrets\shares.passwd")) ){
     $sh_username=Get-Content -path "C:\ProgramData\Docker\secrets\shares.username"
     $sh_passwd=Get-Content -path "C:\ProgramData\Docker\secrets\shares.passwd"
-    New-SmbMapping -RemotePath $env:serviceshare -UserName $sh_username -Password $sh_passwd
+    New-SmbMapping -RemotePath $env:logshare -UserName $sh_username -Password $sh_passwd
+    New-SmbMapping -RemotePath $env:filesshare -UserName $sh_username -Password $sh_passwd
 }
 else {
-    New-SmbMapping -RemotePath $env:serviceshare
+    New-SmbMapping -RemotePath $env:logshare
+    New-SmbMapping -RemotePath $env:filesshare
 }
 
-new-item -ItemType SymbolicLink -path C:\Services\Analis -Name Log -value $env:logshare -Force
-new-item -ItemType SymbolicLink -path $env:filespath -Name Files -value $env:filesshare -Force
+new-item -ItemType SymbolicLink -path 'C:\Services\Analis\Log' -value $env:logshare -Force
+new-item -ItemType SymbolicLink -path $env:filespath -value $env:filesshare -Force
 
 if ( -Not (test-path("C:\Services\Analis\analis.conf")) ){
     move-item -path C:\Services\Analis\analis-default.conf -destination C:\Services\Analis\analis.conf
 }
 
+echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
+echo "log start time and args"
+date >> C:\Services\Analis\Log\starttime.txt
+echo "args are $args" >> C:\Services\Analis\Log\starttime.txt
+echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
 echo Get-SmbMapping
 Get-SmbMapping
+echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
 echo ls C:\Services\Analis\Log
 ls C:\Services\Analis\Log
-echo ls $env:filesshare
-ls $env:filesshare
-C:\Services\Analis\AnalisServer.exe $args
+echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
+echo "Starting C:\Services\Analis\AnalisServer.exe $args"
+cmd /S /C C:\Services\Analis\AnalisServer.exe $args
 
-sleep 1000000