diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b861de6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +FROM php:7.2-alpine + +MAINTAINER @bozdoz + +# install the PHP extensions we need for WP-CLI +RUN set -ex; \ + \ + apk add --no-cache --virtual .build-deps \ + libjpeg-turbo-dev \ + libpng-dev \ + ; \ + \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ + docker-php-ext-install gd mysqli opcache zip; \ + \ + runDeps="$( \ + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + )"; \ + apk add --virtual .wordpress-phpexts-rundeps $runDeps; \ + apk del .build-deps + +RUN set -ex; \ + mkdir -p /var/www/html; \ + chown -R www-data:www-data /var/www/html + +WORKDIR /var/www/html +VOLUME /var/www/html + +RUN curl -L https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > /usr/bin/wp && \ + chmod +x /usr/bin/wp + +ENV WORDPRESS_PORT 1234 + +COPY docker-install.sh /usr/local/bin/ + +RUN chmod 755 /usr/local/bin/docker-install.sh + +CMD [ "docker-install.sh" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9474452 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3.3' + +services: + db: + image: mariadb + volumes: + - wp_db:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: wordpress + MYSQL_USER: wordpress + MYSQL_PASSWORD: wordpress + + wordpress: + image: wordpress:latest + depends_on: + - db + volumes: + - wordpress:/var/www/html + - .:/var/www/html/wp-content/plugins/leaflet-map + ports: + - 1234:80 + restart: always + environment: + WORDPRESS_DB_HOST: db:3306 + WORDPRESS_DB_NAME: wordpress + WORDPRESS_DB_USER: wordpress + WORDPRESS_DB_PASSWORD: wordpress + + cli: + build: . + depends_on: + - wordpress + volumes: + - wordpress:/var/www/html + - .:/var/www/html/wp-content/plugins/leaflet-map + environment: + WORDPRESS_PORT: 1234 + +volumes: + wp_db: + wordpress: \ No newline at end of file diff --git a/docker-install.sh b/docker-install.sh new file mode 100644 index 0000000..0a7d8b0 --- /dev/null +++ b/docker-install.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -euo pipefail + +if [[ -f wp-config.php && -f .cli-initialized ]]; then + exit 0 +fi + +if [ ! -f wp-config.php ]; then + echo "WordPress not found in $PWD!" + ( set -x; ls -A; sleep 15 ) +fi + +if [ ! -f .cli-initialized ]; then + echo "Initializing WordPress install!" + wp --allow-root core install --url="localhost:$WORDPRESS_PORT" --title="Test Leaflet Map" --admin_user=admin --admin_password=password --admin_email=not@real.com --skip-email + + wp --allow-root config set WP_DEBUG true --raw + + wp --allow-root plugin activate leaflet-map + + wp --allow-root post create --post_type=post --post_title='Test Map' --post_content='[leaflet-map] [leaflet-marker]' --post_status='publish' + + touch .cli-initialized +fi \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1a99835..f1d14e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "leaflet-map", - "version": "2.10.0", + "version": "2.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -10,8 +10,8 @@ "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", "dev": true, "requires": { - "no-case": "2.3.2", - "upper-case": "1.1.3" + "no-case": "^2.2.0", + "upper-case": "^1.1.1" } }, "checkup": { @@ -26,7 +26,7 @@ "integrity": "sha1-Nc7ornaHpJuYA09w3gDE7dOCYwE=", "dev": true, "requires": { - "source-map": "0.5.7" + "source-map": "0.5.x" } }, "commander": { @@ -68,14 +68,14 @@ "integrity": "sha1-XM2x9zoNZU5gkBR1Efbmsu4xJwA=", "dev": true, "requires": { - "camel-case": "3.0.0", - "clean-css": "4.1.9", - "commander": "2.12.2", - "he": "1.1.1", - "ncname": "1.0.0", - "param-case": "2.1.1", - "relateurl": "0.2.7", - "uglify-js": "3.3.4" + "camel-case": "3.0.x", + "clean-css": "4.1.x", + "commander": "2.12.x", + "he": "1.1.x", + "ncname": "1.0.x", + "param-case": "2.1.x", + "relateurl": "0.2.x", + "uglify-js": "3.3.x" } }, "ischanged": { @@ -84,12 +84,12 @@ "integrity": "sha1-IFZ/pssBgcVrme2zz8GMrbGWYcQ=", "dev": true, "requires": { - "checkup": "1.3.0", - "debug": "2.6.9", - "mkdirp": "0.5.1", - "readjson": "1.1.3", - "timem": "1.1.2", - "writejson": "1.1.1" + "checkup": "~1.3.0", + "debug": "^2.3.0", + "mkdirp": "~0.5.0", + "readjson": "~1.1.0", + "timem": "~1.1.0", + "writejson": "~1.1.0" }, "dependencies": { "debug": { @@ -115,14 +115,14 @@ "integrity": "sha1-z5UL2+EWVT0j7oiI4FRiDBVHlws=", "dev": true, "requires": { - "clean-css": "4.1.9", - "css-b64-images": "0.2.5", - "debug": "3.1.0", - "execon": "1.2.9", - "html-minifier": "3.5.8", - "tomas": "2.0.2", - "try-catch": "1.0.0", - "uglify-js": "3.3.4" + "clean-css": "^4.1.6", + "css-b64-images": "~0.2.5", + "debug": "^3.0.0", + "execon": "^1.2.9", + "html-minifier": "^3.0.1", + "tomas": "^2.0.0", + "try-catch": "~1.0.0", + "uglify-js": "^3.0.3" } }, "minimist": { @@ -152,7 +152,7 @@ "integrity": "sha1-W1etGLHKCShk72Kwse2BlPODtxw=", "dev": true, "requires": { - "xml-char-classes": "1.0.0" + "xml-char-classes": "^1.0.0" } }, "no-case": { @@ -161,7 +161,7 @@ "integrity": "sha1-YLgTOWvjmz8SiKTB7V0efSi0ZKw=", "dev": true, "requires": { - "lower-case": "1.1.4" + "lower-case": "^1.1.1" } }, "param-case": { @@ -170,7 +170,7 @@ "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", "dev": true, "requires": { - "no-case": "2.3.2" + "no-case": "^2.2.0" } }, "readjson": { @@ -179,7 +179,7 @@ "integrity": "sha1-y0xpFVHG5P7mZ/UcKczi9c6kWTw=", "dev": true, "requires": { - "try-catch": "1.0.0" + "try-catch": "~1.0.0" } }, "relateurl": { @@ -206,10 +206,10 @@ "integrity": "sha1-RAnT054muHsi7LI7coCoT/a0Z1k=", "dev": true, "requires": { - "checkup": "1.3.0", - "execon": "1.2.9", - "ischanged": "1.0.18", - "mkdirp": "0.5.1" + "checkup": "~1.3.0", + "execon": "~1.2.0", + "ischanged": "~1.0.7", + "mkdirp": "~0.5.0" } }, "try-catch": { @@ -224,8 +224,8 @@ "integrity": "sha1-2Ou3byAaN5isLwtlGWQvzKSpmDQ=", "dev": true, "requires": { - "commander": "2.12.2", - "source-map": "0.6.1" + "commander": "~2.12.1", + "source-map": "~0.6.1" }, "dependencies": { "source-map": { @@ -248,7 +248,7 @@ "integrity": "sha1-KnJB5QqBBsO2wQqutW1a4KYJMKo=", "dev": true, "requires": { - "try-catch": "1.0.0" + "try-catch": "~1.0.0" } }, "xml-char-classes": { diff --git a/package.json b/package.json index 5a1615f..3c8ad3c 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "leaflet-map", - "version": "2.11.0", + "version": "2.11.1", "description": "Leaflet Map WordPress Plugin", "main": "index.js", "scripts": { - "minify": "for file in scripts/*.js; do minify $file > ./scripts/$(basename $file .js).min.js; done", + "start": "docker-compose up", + "minify": "npm run clean && for file in scripts/*.js; do minify $file > ./scripts/$(basename $file .js).min.js; done", "clean": "rm scripts/*.min.js", "translate": "cd ./languages && sudo php ../../wp-trunk/tools/i18n/makepot.php wp-plugin ../", "svn": "cd ./svn/trunk && git pull && cd .. && svn cp trunk/ tags/2.10.0",