Skip to content

Instantly share code, notes, and snippets.

@WalternativE
Last active March 7, 2018 14:38
Show Gist options
  • Save WalternativE/b2c4ed32894f427ef8a85e921cfa2bbd to your computer and use it in GitHub Desktop.
Save WalternativE/b2c4ed32894f427ef8a85e921cfa2bbd to your computer and use it in GitHub Desktop.
Trying to get a PostgreSQL instance working on a windows docker container
# escape=`
FROM microsoft/windowsservercore:latest
ADD Wait-Service.ps1 /Wait-Service.ps1
RUN powershell -NoProfile -Command "Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; `
Install-Module NTFSSecurity -Force;"
RUN powershell -NoProfile -Command "New-Item -Type Directory C:\dbdata; New-Item -Type Directory C:\hakomdata;"
VOLUME C:\dbdata
VOLUME C:\hakomdata
RUN powershell -NoProfile -Command "Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices' -Name 'G:' -Value '\??\C:\dbdata' -Type String; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices' -Name 'E:' -Value '\??\C:\hakomdata' -Type String;"
ADD INST /INST
ADD PostgreSQL /DBSCRIPTS
RUN powershell -NoProfile -Command "New-LocalUser -Name 'postgres' -Password (ConvertTo-SecureString !12345Postgr3S%12345! -AsPlainText -Force) -Description 'postgres service account'; `
Add-LocalGroupMember -Group 'Administrators' -Member 'postgres';"
RUN powershell -NoProfile -Command "Import-Module NTFSSecurity; `
Add-NTFSAccess -Path 'G:\' -Account 'postgres' -AccessRights FullControl; `
Add-NTFSAccess -Path 'E:\' -Account 'postgres' -AccessRights FullControl;"
# C:\INST\postgresql-9.5.9-1-windows-x64.exe --optionfile C:\INST\optionfile;"
# RUN powershell -NoProfile -Command "Stop-Service postgresql95; `
# Copy-Item C:\INST\pg_hba.conf -Destination 'C:\Program Files\PostgreSQL\9.5\data\pg_hba.conf' -Force; "
# RUN powershell -NoProfile -Command "$env:Path += ';C:\Program Files\PostgreSQL\9.5\bin'; `
# Start-Service postgresql95; `
# New-Item -Type Directory C:\dbdata\hakomdata\data; `
# New-Item -Type Directory C:\dbdata\hakomdata\idx; `
# C:\DBSCRIPTS\V034\install.cmd; `
# Stop-Service postgresql95;"
#SHELL ["powershell","-noprofile","-command"]
#EXPOSE 5432
#ENTRYPOINT "C:\Wait-Service"
#CMD ["postgresql95"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment