Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/commands/restart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default function Restart() {
hostname,
phpMyAdminHostname,
wordpressVersion: pc.wordpress.version,
phpVersion: pc.wordpress.php_version,
dbPassword: lc.db_password,
loginSecret: lc.login_secret,
muPluginPath,
Expand Down
1 change: 1 addition & 0 deletions src/commands/up.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export default function Up() {
hostname,
phpMyAdminHostname,
wordpressVersion: pc.wordpress.version,
phpVersion: pc.wordpress.php_version,
dbPassword: lc.db_password,
loginSecret: lc.login_secret,
muPluginPath,
Expand Down
14 changes: 9 additions & 5 deletions src/providers/BitnamiRuntimeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import type {
const KIQR_NETWORK = 'kiqr';

export class BitnamiRuntimeProvider implements RuntimeProvider {
getWordPressImage(version: string, _phpVersion: string): string {
if (version === 'latest') return 'wordpress:latest';
return `wordpress:${version}`;
getWordPressImage(version: string, phpVersion: string): string {
// The official `wordpress` image publishes PHP-pinned tags:
// - `wordpress:php8.3` for the latest WordPress on a given PHP version
// - `wordpress:6.7-php8.3` for a specific WordPress + PHP combination
// See https://hub.docker.com/_/wordpress/tags
if (version === 'latest') return `wordpress:php${phpVersion}`;
return `wordpress:${version}-php${phpVersion}`;
}

getThemeMountTarget(themeSlug: string): string {
Expand Down Expand Up @@ -39,7 +43,7 @@ export class BitnamiRuntimeProvider implements RuntimeProvider {

return {
wordpress: {
image: this.getWordPressImage(config.wordpressVersion, '8.3'),
image: this.getWordPressImage(config.wordpressVersion, config.phpVersion),
environment: {
...this.getEnvironmentVariables(credentials),
KIQR_LOGIN_SECRET: config.loginSecret,
Expand Down Expand Up @@ -77,7 +81,7 @@ export class BitnamiRuntimeProvider implements RuntimeProvider {
restart: 'unless-stopped',
},
wpcli: {
image: 'wordpress:cli-php8.3',
image: `wordpress:cli-php${config.phpVersion}`,
environment: {
WORDPRESS_DB_HOST: 'mariadb',
WORDPRESS_DB_NAME: credentials.dbName,
Expand Down
1 change: 1 addition & 0 deletions src/providers/RuntimeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface RuntimeConfig {
hostname: string;
phpMyAdminHostname: string;
wordpressVersion: string;
phpVersion: string;
dbPassword: string;
loginSecret: string;
muPluginPath: string;
Expand Down
1 change: 1 addition & 0 deletions tests/lib/compose.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('generateProjectCompose', () => {
hostname: 'my-theme.test.local',
phpMyAdminHostname: 'phpmyadmin.my-theme.test.local',
wordpressVersion: 'latest',
phpVersion: '8.3',
dbPassword: 'test_password',
loginSecret: 'secret123',
muPluginPath: '/tmp/mu-plugin.php',
Expand Down
22 changes: 18 additions & 4 deletions tests/providers/BitnamiRuntimeProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ import {BitnamiRuntimeProvider} from '../../src/providers/BitnamiRuntimeProvider
describe('BitnamiRuntimeProvider', () => {
const provider = new BitnamiRuntimeProvider();

it('returns wordpress image name', () => {
it('returns the php-pinned latest image when version is latest', () => {
const image = provider.getWordPressImage('latest', '8.3');
expect(image).toBe('wordpress:latest');
expect(image).toBe('wordpress:php8.3');
});

it('returns a version+php-pinned image for a specific version', () => {
const image = provider.getWordPressImage('6.7', '8.4');
expect(image).toBe('wordpress:6.7-php8.4');
});

it('honors the configured php version', () => {
expect(provider.getWordPressImage('latest', '8.2')).toBe('wordpress:php8.2');
expect(provider.getWordPressImage('6.7', '8.2')).toBe('wordpress:6.7-php8.2');
});

it('returns correct theme mount target', () => {
Expand All @@ -32,6 +42,7 @@ describe('BitnamiRuntimeProvider', () => {
hostname: 'my-theme.test.lvh.me',
phpMyAdminHostname: 'phpmyadmin.my-theme.test.lvh.me',
wordpressVersion: '6.7',
phpVersion: '8.3',
dbPassword: 'test_password',
loginSecret: 'secret123',
muPluginPath: '/tmp/mu-plugin.php',
Expand All @@ -42,7 +53,8 @@ describe('BitnamiRuntimeProvider', () => {
expect(services['wordpress']).toBeDefined();
expect(services['mariadb']).toBeDefined();
expect(services['phpmyadmin']).toBeDefined();
expect(services['wordpress']!.image).toBe('wordpress:6.7');
expect(services['wordpress']!.image).toBe('wordpress:6.7-php8.3');
expect(services['wpcli']!.image).toBe('wordpress:cli-php8.3');
expect(services['mariadb']!.image).toBe('mariadb:11.4');
});

Expand All @@ -54,13 +66,15 @@ describe('BitnamiRuntimeProvider', () => {
hostname: 'my-theme.test.lvh.me',
phpMyAdminHostname: 'phpmyadmin.my-theme.test.lvh.me',
wordpressVersion: 'latest',
phpVersion: '8.4',
dbPassword: 'test_password',
loginSecret: 'secret123',
muPluginPath: '/tmp/mu-plugin.php',
pluginsPath: '/tmp/plugins',
uploadsPath: '/tmp/uploads',
dataDir: '/tmp/kiqr/projects/uuid',
});
expect(services['wordpress']!.image).toBe('wordpress:latest');
expect(services['wordpress']!.image).toBe('wordpress:php8.4');
expect(services['wpcli']!.image).toBe('wordpress:cli-php8.4');
});
});
Loading