diff --git a/remote-builder/nginx-php/README.md b/remote-builder/nginx-php/README.md new file mode 100644 index 0000000..17a98af --- /dev/null +++ b/remote-builder/nginx-php/README.md @@ -0,0 +1,28 @@ +# Nginx & PHP + +1. Build the container via the Sylabs Remote Builder + +2. Pull container from the library + ```sh + singularity pull nginx.sif library:// + ``` + +3. Start the container image. + ```sh + sudo singularity instance start --writable-tmpfs --net --network bridge --network-args "portmap=8080:80/tcp" nginx.sif nginx + ``` + +4. Access the nginx container running on port 8080 + ```sh + $ curl -i localhost:8080/index.php + + HTTP/1.1 200 OK + Connection: keep-alive + Content-Type: text/html; charset=UTF-8 + Date: Mon, 07 Jun 2021 15:45:43 GMT + Server: nginx/1.21.0 + Transfer-Encoding: chunked + X-Powered-By: PHP/8.0.6 + +

Hello from php and nginx in a sif

+ ``` \ No newline at end of file diff --git a/remote-builder/nginx-php/nginx.def b/remote-builder/nginx-php/nginx.def new file mode 100644 index 0000000..6c91265 --- /dev/null +++ b/remote-builder/nginx-php/nginx.def @@ -0,0 +1,60 @@ +Bootstrap: docker +From: nginx:alpine + +%setup + +cat > /tmp/default.conf < /tmp/index.php < +EOF + +cat > /tmp/php.conf < + ``` +3. Run the container as an instance: + ```sh + singularity instance start node.sif node + ``` +4. Access the web-server via curl + ```sh + $ curl -i localhost:4000 + + HTTP/1.1 200 OK + X-Powered-By: Express + Content-Type: text/html; charset=utf-8 + Content-Length: 12 + Date: Mon, 07 Jun 2021 15:26:29 GMT + Connection: keep-alive + Keep-Alive: timeout=5 + + Hello World! + ``` diff --git a/remote-builder/nodejs/nodejs.def b/remote-builder/nodejs/nodejs.def new file mode 100644 index 0000000..ddfd1e0 --- /dev/null +++ b/remote-builder/nodejs/nodejs.def @@ -0,0 +1,47 @@ +Bootstrap: docker +From: node:16-alpine + +%setup + mkdir -p ${SINGULARITY_ROOTFS}/usr/local/share/node/app + mkdir -p app +cat > app/index.js < { + res.send("Hello World!"); +}); + +app.listen(port, () => { + console.log(`Example app listening at http://localhost:${port}`); +}); +EOF + +cat > app/package.json <