Skip to content

Commit a37c14a

Browse files
authored
Merge pull request #2 from imagekit-developer/v5.0.0
2 parents 7627803 + 5678070 commit a37c14a

123 files changed

Lines changed: 69283 additions & 3896 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
FROM php:8.4.16-apache
2+
3+
# --------------------------------------------------
4+
# PHP base configuration
5+
# --------------------------------------------------
6+
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
7+
8+
# set php memory limit to -1
9+
RUN sed -i 's/memory_limit = .*/memory_limit = -1/' $PHP_INI_DIR/php.ini
10+
11+
# Enable .htaccess files & mod_rewrite
12+
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride all/' /etc/apache2/apache2.conf
13+
RUN a2enmod rewrite
14+
15+
# --------------------------------------------------
16+
# System packages (WordPress-like setup)
17+
# --------------------------------------------------
18+
RUN set -eux; \
19+
apt-get update; \
20+
apt-get install -y --no-install-recommends \
21+
ghostscript \
22+
git \
23+
less \
24+
ssh-client \
25+
mariadb-client \
26+
curl \
27+
ca-certificates \
28+
bash \
29+
; \
30+
rm -rf /var/lib/apt/lists/*
31+
32+
# --------------------------------------------------
33+
# PHP extensions + Xdebug
34+
# --------------------------------------------------
35+
RUN set -ex; \
36+
apt-get update; \
37+
apt-get install -y --no-install-recommends \
38+
libfreetype6-dev \
39+
libjpeg-dev \
40+
libmagickwand-dev \
41+
libpng-dev \
42+
libzip-dev \
43+
libyaml-dev \
44+
; \
45+
docker-php-ext-configure gd --with-freetype --with-jpeg; \
46+
docker-php-ext-install -j "$(nproc)" \
47+
bcmath \
48+
exif \
49+
gd \
50+
mysqli \
51+
opcache \
52+
zip \
53+
; \
54+
pecl install imagick-3.8.0; \
55+
pecl install xdebug-3.4.3; \
56+
pecl install yaml; \
57+
pear install PHP_CodeSniffer; \
58+
docker-php-ext-enable imagick xdebug yaml; \
59+
rm -rf /var/lib/apt/lists/*
60+
61+
# --------------------------------------------------
62+
# Xdebug config
63+
# --------------------------------------------------
64+
RUN echo "[xdebug]\n\
65+
xdebug.mode = debug\n\
66+
xdebug.start_with_request = 1" \
67+
> $PHP_INI_DIR/conf.d/xdebug.ini
68+
69+
# --------------------------------------------------
70+
# OPcache recommended settings (WP)
71+
# --------------------------------------------------
72+
RUN { \
73+
echo 'opcache.memory_consumption=128'; \
74+
echo 'opcache.interned_strings_buffer=8'; \
75+
echo 'opcache.max_accelerated_files=4000'; \
76+
echo 'opcache.revalidate_freq=2'; \
77+
echo 'opcache.fast_shutdown=1'; \
78+
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
79+
80+
# --------------------------------------------------
81+
# WP-CLI
82+
# --------------------------------------------------
83+
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
84+
&& chmod +x wp-cli.phar \
85+
&& mv wp-cli.phar /usr/local/bin/wp
86+
87+
# --------------------------------------------------
88+
# Composer
89+
# --------------------------------------------------
90+
WORKDIR /tmp
91+
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
92+
&& php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=composer \
93+
&& rm composer-setup.php
94+
95+
# --------------------------------------------------
96+
# Create vscode user
97+
# --------------------------------------------------
98+
RUN useradd -ms /bin/bash vscode \
99+
&& usermod -aG www-data vscode
100+
101+
# --------------------------------------------------
102+
# NVM + Node.js (for vscode user)
103+
# --------------------------------------------------
104+
USER vscode
105+
106+
ENV NVM_DIR=/home/vscode/.nvm
107+
ENV NODE_VERSION=20
108+
109+
RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
110+
&& . "$NVM_DIR/nvm.sh" \
111+
&& nvm install $NODE_VERSION \
112+
&& nvm alias default $NODE_VERSION \
113+
&& nvm use default
114+
115+
# Load nvm automatically in shells
116+
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> /home/vscode/.bashrc \
117+
&& echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /home/vscode/.bashrc \
118+
&& echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> /home/vscode/.bashrc
119+
120+
# Make node available for non-login shells (VS Code, CI, etc.)
121+
ENV PATH=/home/vscode/.nvm/versions/node/v20.*/bin:$PATH
122+
123+
# --------------------------------------------------
124+
# WordPress setup
125+
# --------------------------------------------------
126+
WORKDIR /var/www/html
127+
USER www-data
128+
129+
# Download WordPress core
130+
RUN wp core download
131+
132+
# Create plugin directory
133+
RUN mkdir -p /var/www/html/wp-content/plugins/imagekit
134+
135+
# --------------------------------------------------
136+
# Permissions
137+
# --------------------------------------------------
138+
USER root
139+
RUN chown -R www-data:www-data /var/www/html/ \
140+
&& chmod g+w -R /var/www/html/ \
141+
&& find /var/www/html/ -type d -exec chmod g+s {} \;

.devcontainer/data/plugins/.keep

Whitespace-only changes.

.devcontainer/devcontainer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "WordPress",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "wordpress",
5+
"workspaceFolder": "/var/www/html/wp-content/plugins/imagekit",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": ["felixfbecker.php-pack", "wordpresstoolbox.wordpress-toolbox", "johnbillion.vscode-wordpress-hooks"],
9+
"settings": {
10+
"terminal.integrated.shell.linux": "/bin/bash",
11+
"php.suggest.basic": false
12+
}
13+
}
14+
},
15+
"postCreateCommand": ".devcontainer/wp-setup.sh",
16+
"remoteUser": "vscode"
17+
}

.devcontainer/docker-compose.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: '3'
2+
services:
3+
wordpress:
4+
build: ./
5+
ports:
6+
- 80:80
7+
depends_on:
8+
- db
9+
environment:
10+
WORDPRESS_DB_HOST: db
11+
WORDPRESS_DB_USER: wp_user
12+
WORDPRESS_DB_PASSWORD: wp_pass
13+
WORDPRESS_DB_NAME: wordpress
14+
WORDPRESS_DEBUG: 1
15+
links:
16+
- db
17+
volumes:
18+
#Swap the folder path for plugin vs theme development
19+
- wordpress:/var/www/html
20+
- ../:/var/www/html/wp-content/plugins/imagekit
21+
- ./.idea:/var/www/html/wp-content/plugins/imagekit/.idea
22+
#- ../:/var/www/html/wp-content/themes/theme-dev
23+
24+
db:
25+
image: mariadb:11.4
26+
environment:
27+
MYSQL_DATABASE: wordpress
28+
MYSQL_USER: wp_user
29+
MYSQL_PASSWORD: wp_pass
30+
MYSQL_RANDOM_ROOT_PASSWORD: '1'
31+
ports:
32+
- 3306:3306
33+
volumes:
34+
- data:/var/lib/mysql
35+
36+
volumes:
37+
wordpress:
38+
data:

.devcontainer/wp-setup.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#! /bin/bash
2+
3+
#Site configuration options
4+
SITE_TITLE="Dev Site"
5+
ADMIN_USER=admin
6+
ADMIN_PASS=password
7+
ADMIN_EMAIL="admin@localhost.com"
8+
#Space-separated list of plugin ID's to install and activate
9+
PLUGINS=""
10+
11+
#Set to true to wipe out and reset your wordpress install (on next container rebuild)
12+
WP_RESET=true
13+
14+
echo "Setting up WordPress"
15+
DEVDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
16+
cd /var/www/html;
17+
if $WP_RESET ; then
18+
echo "Resetting WP"
19+
wp plugin delete $PLUGINS
20+
wp db reset --yes
21+
rm wp-config.php;
22+
fi
23+
24+
if [ ! -f wp-config.php ]; then
25+
echo "Configuring";
26+
wp config create --dbhost="db" --dbname="wordpress" --dbuser="wp_user" --dbpass="wp_pass" --skip-check;
27+
wp core install --url="http://localhost:8080" --title="$SITE_TITLE" --admin_user="$ADMIN_USER" --admin_email="$ADMIN_EMAIL" --admin_password="$ADMIN_PASS" --skip-email;
28+
wp plugin install $PLUGINS --activate
29+
#TODO: Only activate plugin if it contains files - i.e. might be developing a theme instead
30+
wp plugin activate plugin-dev
31+
32+
#Data import
33+
cd $DEVDIR/data/
34+
for f in *.sql; do
35+
wp db import $f
36+
done
37+
38+
cp -r plugins/* /var/www/html/wp-content/plugins
39+
for p in plugins/*; do
40+
wp plugin activate $(basename $p)
41+
done
42+
43+
else
44+
echo "Already configured"
45+
fi

.github/workflows/assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Push to trunk
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@master
11+
- uses: actions/checkout@v4
1212
- name: WordPress.org plugin asset/readme update
1313
uses: 10up/action-wordpress-plugin-asset-update@stable
1414
env:

.github/workflows/main.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,29 @@ jobs:
1010
name: New tag
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@master
13+
- uses: actions/checkout@v4
14+
- name: Setup Node
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '18'
18+
- name: Install dependencies
19+
run: npm ci
20+
- name: Build
21+
run: npm run package:build
1422
- name: WordPress Plugin Deploy
15-
uses: 10up/action-wordpress-plugin-deploy@master
23+
id: deploy
24+
uses: 10up/action-wordpress-plugin-deploy@stable
25+
with:
26+
generate-zip: true
1627
env:
1728
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
1829
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
1930
SLUG: imagekit
31+
BUILD_DIR: build
32+
2033
- name: Upload release asset
21-
uses: actions/upload-release-asset@v1
34+
uses: softprops/action-gh-release@v2
2235
env:
2336
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2437
with:
25-
upload_url: ${{ github.event.release.upload_url }}
26-
asset_path: ${{github.workspace}}/${{ github.event.repository.name }}.zip
27-
asset_name: ${{ github.event.repository.name }}.zip
28-
asset_content_type: application/zip
38+
files: ${{ steps.deploy.outputs.zip-path }}

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
*.log
2+
wp-config.php
3+
wp-content/advanced-cache.php
4+
wp-content/backup-db/
5+
wp-content/backups/
6+
wp-content/blogs.dir/
7+
wp-content/cache/
8+
wp-content/upgrade/
9+
wp-content/uploads/
10+
wp-content/mu-plugins/
11+
wp-content/wp-cache-config.php
12+
wp-content/plugins/hello.php
13+
14+
/.htaccess
15+
/license.txt
16+
/readme.html
17+
/sitemap.xml
18+
/sitemap.xml.gz
19+
20+
.DS_Store
21+
22+
# Grunt
23+
/build/
24+
/node_modules/
25+
npm-debug.log
26+
27+
# Dev
28+
/vendor/
29+
/dev-lib/
30+
phpcs.xml
31+
css/*.map
32+
js/*.map
33+
/bin
34+
35+
# Tests
36+
tests/data/
37+
tests/includes/
38+
coverage/html/
39+
40+
# ENV files
41+
.env
42+
43+
# wp-env
44+
.wp-env.json
45+
46+
# IDE
47+
.vscode
48+
49+
# Testing packages
50+
package/dist

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.19.6

.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.0.0

0 commit comments

Comments
 (0)