From c4cd3a7df8ad627f15a3bc6392f2b83d4c33e1b3 Mon Sep 17 00:00:00 2001 From: Candido Tominaga Date: Mon, 19 Apr 2021 12:53:42 -0300 Subject: [PATCH] docker example --- Dockerfile | 15 +++++++++++++++ docker-compose.yml | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..db81be2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:3.13.3 + +RUN apk add curl openssl php7 php7-curl php7-openssl php7-gmp php7-mbstring php7-json php7-phar + +RUN curl -sS https://getcomposer.org/installer | php7 -- --install-dir=/usr/local/bin --filename=composer + +RUN mkdir /app; cd /app; composer create-project minishlink/web-push-php-example + +RUN cd /app/web-push-php-example; openssl ecparam -genkey -name prime256v1 -out keys/private_key.pem && \ + openssl ec -in private_key.pem -pubout -outform DER|tail -c 65|base64|tr -d '=' |tr '/+' '_-' >> keys/public_key.txt && \ + openssl ec -in private_key.pem -outform DER|tail -c +8|head -c 32|base64|tr -d '=' |tr '/+' '_-' >> keys/private_key.txt + +EXPOSE 8000 + +CMD [ "php", "-S", "0.0.0.0:8000", "/app/web-push-php-example/router.php" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5faa027 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.7' +# https://github.com/c4tom/web-push-php + +services: + web_push_php: + image: cahato/web-push-php:latest + build: + context: ./ + dockerfile: Dockerfile + container_name: alpine_php_webpush_php + hostname: web_push_php + ports: + - "8000:8000" \ No newline at end of file