Skip to content

Commit

Permalink
Add php-sdk to e2e tests (#2707)
Browse files Browse the repository at this point in the history
  • Loading branch information
withinboredom committed Feb 25, 2021
1 parent 42c0b3d commit ea1bd6c
Show file tree
Hide file tree
Showing 11 changed files with 1,421 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/apps/actorphp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor
18 changes: 18 additions & 0 deletions tests/apps/actorphp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM php:8-cli

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN apt-get update && apt-get install -y wget git unzip && apt-get clean
RUN install-php-extensions curl zip
EXPOSE 3000
RUN mkdir -p /app
WORKDIR /app
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY composer.json /app/composer.json
COPY composer.lock /app/composer.lock
RUN composer install --no-dev -o -n

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
ENTRYPOINT ["php"]
CMD ["-S", "0.0.0.0:3000", "-t", "/app/src"]
ENV PHP_CLI_SERVER_WORKERS=50
COPY src/ src/
32 changes: 32 additions & 0 deletions tests/apps/actorphp/Dockerfile-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-1909

RUN powershell -Command \
$ErrorActionPreference = 'Stop'; \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Method Get -Uri https://windows.php.net/downloads/releases/php-8.0.2-nts-Win32-vs16-x64.zip -OutFile c:\php.zip ; \
Expand-Archive -Path c:\php.zip -DestinationPath c:\php ; \
Remove-Item c:\php.zip -Force

ADD https://aka.ms/vs/16/release/VC_redist.x64.exe vc-redist.exe
RUN start /w vc-redist.exe /q /norestart & del vc-redist.exe

RUN powershell.exe -executionpolicy bypass "Add-WindowsFeature Web-CGI"

ADD https://curl.haxx.se/ca/cacert.pem ca.pem
RUN powershell -command cp ca.pem "C:\php\\" && powershell -command cp c:\php\php.ini-production c:\php\php.ini
RUN powershell -command echo 'extension=php_mbstring.dll' 'extension=php_curl.dll' 'extension=php_openssl.dll' '[PHP_FILEINFO]' 'extension=php_fileinfo.dll' ' ' ' ' 'curl.cainfo = c:\php\ca.pem' >> C:\php\php.ini

RUN %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\php\php-cgi.exe']
RUN %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Either']
RUN %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /[fullPath='c:\PHP\php-cgi.exe'].instanceMaxRequests:10000
RUN %windir%\system32\inetsrv\appcmd.exe set config /section:defaultDocument /enabled:true /+files.[value='index.php']
RUN setx PATH /M %PATH%;C:\PHP

RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
WORKDIR /inetpub
ADD https://getcomposer.org/composer-stable.phar composer.phar
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN php composer.phar install --no-dev -o -n --prefer-dist
WORKDIR /inetpub/wwwroot
COPY src .
27 changes: 27 additions & 0 deletions tests/apps/actorphp/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "dapr/actorphp",
"description": "A simple e2e test actor",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Rob Landers",
"email": "landers.robert@gmail.com"
}
],
"minimum-stability": "dev",
"require": {
"dapr/php-sdk": "1.*"
},
"autoload": {
"psr-4": {
"Test\\": "src"
}
},
"scripts": {
"start-env": [
"docker build -t php-sdk-test .",
"docker run --rm --name=phpsdktest -v $(pwd):/app -p 3000:3000 php-sdk-test"
]
}
}
Loading

0 comments on commit ea1bd6c

Please sign in to comment.