Merge pull request #98189 from claudiubelu/test-images/echoserver-windows

test images: Fixes echoserver image for Windows
This commit is contained in:
Kubernetes Prow Robot 2021-01-21 04:39:01 -08:00 committed by GitHub
commit 6a161bf6d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View File

@ -19,21 +19,24 @@ ARG REGISTRY
FROM --platform=linux/amd64 alpine:3.6 as prep FROM --platform=linux/amd64 alpine:3.6 as prep
ADD https://openresty.org/download/openresty-1.13.6.2-win64.zip /openresty-win64.zip ADD https://openresty.org/download/openresty-1.13.6.2-win64.zip /openresty-win64.zip
ADD http://wiki.overbyte.eu/arch/openssl-1.1.1i-win64.zip /openssl.zip
RUN mkdir /openresty &&\ RUN mkdir /openresty &&\
unzip /openresty-win64.zip -d /openresty unzip /openresty-win64.zip -d /openresty &&\
mkdir /openssl &&\
unzip /openssl.zip -d /openssl
FROM $REGISTRY/windows-image-builder-helper:1.1-windows-amd64-1809 as helper
FROM $BASEIMAGE FROM $BASEIMAGE
COPY --from=prep /openresty/openresty-1.13.6.2-win64 /openresty COPY --from=prep /openresty/openresty-1.13.6.2-win64 /openresty
COPY --from=helper /Windows/System32/vcruntime140.dll /Windows/System32/ COPY --from=prep /openssl /openssl
COPY --from=helper ["/Program Files/OpenSSL", "/Program Files/OpenSSL"]
ENV PATH="C:\openresty\;C:\bin\;C:\curl\;C:\Windows\system32;C:\Windows;C:\Program Files\PowerShell;" ADD ["https://raw.githubusercontent.com/openssl/openssl/OpenSSL_1_1_1i/apps/openssl.cnf", "/Program Files/Common Files/SSL/openssl.cnf"]
ENV PATH="C:\openssl\;C:\openresty\;C:\bin\;C:\curl\;C:\Windows\system32;C:\Windows;C:\Program Files\PowerShell;"
ADD run.sh /openresty/run.sh ADD run.sh /openresty/run.sh
ADD nginx.conf /openresty/conf/nginx.conf ADD nginx.conf /openresty/conf/nginx.conf
ADD template.lua /openresty/lua/template.lua ADD template.lua /openresty/lua/template.lua
EXPOSE 80 443 8080 8443 EXPOSE 80 443 8080 8443
ENTRYPOINT ["/bin/sh", "/openresty/run.sh"] ENTRYPOINT ["/bin/sh", "-c", " cd /openresty && ./run.sh"]

View File

@ -21,5 +21,15 @@ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 \
-out /certs/certificate.crt \ -out /certs/certificate.crt \
-subj "/C=UK/ST=Warwickshire/L=Leamington/O=OrgName/OU=IT Department/CN=example.com" -subj "/C=UK/ST=Warwickshire/L=Leamington/O=OrgName/OU=IT Department/CN=example.com"
# If we're running on Windows, skip loading the Linux .so modules.
if [ "$(uname)" = "Windows_NT" ]; then
sed -i -E "s/^(load_module modules\/ndk_http_module.so;)$/#\1/" conf/nginx.conf
sed -i -E "s/^(load_module modules\/ngx_http_lua_module.so;)$/#\1/" conf/nginx.conf
sed -i -E "s/^(load_module modules\/ngx_http_lua_upstream_module.so;)$/#\1/" conf/nginx.conf
# NOTE(claudiub): on Windows, nginx will take the paths in the nginx.conf file as relative paths.
cmd /S /C "mklink /D C:\\openresty\\certs C:\\certs"
fi
echo "Starting nginx" echo "Starting nginx"
nginx -g "daemon off;" nginx -g "daemon off;"