Skip to content

Provide a php dependency only image without wordpress specific files  #764

Open

Description

@jooola

Could it be possible for the WordPress docker image to provide a php dependency only tag variant ?

The regular image currently provides a zip with a version of WordPress and a custom entry point. But you sometimes do not need thoses files and they might also mess your custom setup (for example extracting WP while it shouldn't).

It would be great if this current image is split into 2 stages, one for the php dependencies, and the next one for the wordpress specific files. This should allow me to reuse the wordpress image to build my own docker image ?

I would see maybe a stage around here:

We could then have for example:

FROM wordpress:apache-bare

COPY . /var/www/html

Activity

  1. added
    questionUsability question, not directly related to an error with the image
    on Oct 11, 2022
  2. wglambert commented on Oct 11, 2022

    @wglambert
  3. jooola commented on Oct 11, 2022

    @jooola
    Author

    I guess that's the idea, but including all the php extensions and settings required/recommended by wordpress.

  4. gerwinjansen commented on Nov 12, 2022

    @gerwinjansen

    My goal is to bring my Wordpress based application under version control. I'm using PHP Composer and roots/bedrock to compose my webroot directory and I use a .env file for the settings and secrets.
    Next, I want to create a docker image from this webroot directory with a volume for the upload directory and a docker secret for the .env file.
    The ultimate goal is to setup a DTAP cycle to deliver my application.

    I prefer to use an official docker image from Wordpress so that I don't have to do the maintenance of PHP configuration and extensions myself.
    I can replace the /usr/src/wordpress/ with my webroot and I found a workaround for the Entrypoint.
    But I can't 'undo' the volume of the official image. Hence my support for this request.

    Workarounds I can think off:

    1. Make a copy of the official Docker file, watch for changes and manually apply patches if needed.
    2. Copy operating system files from the official image to my own image.

    Both are not very attractive.

  5. jooola commented on Jan 27, 2023

    @jooola
    Author

    I used a dirty workaround for now (feel free to propose some improvement):

    FROM wordpress:6.1-php8.0-apache as wordpress
    
    RUN set -eux; \
        rm -Rf \
        /usr/local/bin/docker-entrypoint.sh \
        /usr/src/wordpress \
        /var/www/html/*
    
    FROM scratch
    COPY --from=wordpress / /
    
    CMD ["apache2-foreground"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions