forked from Sitecore/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (34 loc) · 1.81 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# escape=`
ARG BUILD_IMAGE
ARG BASE_IMAGE
FROM $BUILD_IMAGE as builder
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG SOLR_VERSION
ARG CORE_NAMES
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest -Uri ('https://archive.apache.org/dist/lucene/solr/{0}/solr-{0}.zip' -f $env:SOLR_VERSION) -OutFile 'C:\\solr.zip'; `
Expand-Archive -Path 'C:\\solr.zip' -DestinationPath 'C:\\temp'; `
Move-Item -Path 'C:\\temp\\solr-*' -Destination 'C:\\solr';
COPY managed-schema.* C:\\temp\\
RUN New-Item -Path 'C:\\clean' -ItemType Directory | Out-Null; `
Copy-Item -Path 'C:\\solr\\server\\solr\\*' -Destination 'C:\\clean' -Force -Recurse; `
$env:CORE_NAMES -split ',' | ForEach-Object { `
$name = $_.Trim(); `
$schema = @{$true='C:\\temp\\managed-schema.xdb';$false='C:\\temp\\managed-schema.default'}[$name -like '*xdb*']; `
Copy-Item -Path 'C:\\clean\\configsets\\_default\\conf' -Destination ('C:\\clean\\{0}\\conf' -f $name) -Recurse -Force; `
Copy-Item -Path $schema -Destination ('C:\\clean\\{0}\\conf\\managed-schema' -f $name); `
New-Item -Path ('C:\\clean\\{0}\\core.properties' -f $name) -ItemType File | Out-Null; `
New-Item -Path ('C:\\clean\\{0}\\data' -f $name) -ItemType Directory | Out-Null; `
}; `
Remove-Item -Path 'C:\\clean\\README.txt'; `
Remove-Item -Path 'C:\\clean\\configsets' -Recurse;
FROM $BASE_IMAGE
USER ContainerAdministrator
COPY --from=builder ["C:\\solr", "C:\\solr"]
COPY --from=builder ["C:\\clean", "C:\\clean"]
COPY --from=builder ["C:\\windows\\system32\\find.exe", "C:\\windows\\system32\\"]
RUN MKDIR c:\\data
ENV SOLR_HOME=c:/data
EXPOSE 8983
COPY Boot.cmd .
CMD Boot.cmd c:\\solr 8983 c:\\clean c:\\data