osixia / docker-phpLDAPadmin

phpLDAPadmin container image 🐳🌴
MIT License
844 stars 197 forks source link

how can i add a template ? #30

Open xgodon opened 7 years ago

xgodon commented 7 years ago

I'd like to add a template in /var/www/phpldapadmin/templates/creation/ at the image start. How can i do? extending the image like :

FROM osixia/phpldapadmin:0.6.12 COPY custom_posixAccount.xml /var/www/phpldapadmin/templates/creation/custom_posixAccount.xml

give me the error : "phpldapadmin_1 | cp: cannot create regular file ‘/var/www/phpldapadmin/config/config.php’: No such file or directory"

dcendents commented 6 years ago

I had the same problem. Lokking at the Dockerfile and the scripts, I figured you can copy them to the bootstrap directory to make it work.

e.g.:

FROM osixia/phpldapadmin:0.7.0
COPY custom_posixAccount.xml /var/www/phpldapadmin_bootstrap/templates/creation/custom_posixAccount.xml
JensPfeifle commented 5 years ago

Neither works for me:

FROM osixia/phpldapadmin:0.7.2
COPY custom_example.xml /var/www/phpldapadmin_bootstrap/templates/creation/custom_example.xml
COPY custom_example.xml /var/www/phpldapadmin/templates/creation/custom_example.xml

custom_example.xml is successfully copied to /var/www/phpldapadmin_bootstrap/templates/creation/ but is not found in /var/www/phpldapadmin/templates/creation/. If I copy the xml manually (with docker exec) from phpldapadmin_bootstrap to phpldapadmin, I can see that the template loads correctly in the web interface.

I have also tried setting the file permissions to match the other template files with RUN chown www-data:www-data /var/www/phpldapadmin_bootstrap/templates/creation/custom_example.xml

Anything I'm missing here?

danekja commented 5 years ago

The dockerfile declares a VOLUME for /var/www/phpldapadmin. You need to remove it inbetween changes, otherwise they are not updated from the bootstrap folder.

shynome commented 5 years ago

@BertrandGouny why not remove the Dockerfile config

VOLUME ["/var/www/phpldapadmin"]

it make difficulty to build my docke image, I have to rebuild the docker image, can't build from this image, I think the rebuild time is wasteful, can you improve this ?

At last, thanks for your spend time to complete this good project

graue70 commented 5 years ago

I had the same problem and the solution given in https://github.com/osixia/docker-phpLDAPadmin/issues/30#issuecomment-324091598 worked perfectly for me with version 0.7.2. Thank you!

Vsevo1od commented 3 years ago

Here is how I did it: Dockerfile

FROM osixia/phpldapadmin:0.9.0
COPY customUser.xml /
COPY startup.sh /container/service/phpldapadmin-additional-templates/
RUN chmod +x /container/service/phpldapadmin-additional-templates/startup.sh

startup.sh

#!/bin/bash -e
TEMPLATE_PATH=/customUser.xml

if [ -f $TEMPLATE_PATH ]; then
  mv $TEMPLATE_PATH  /var/www/phpldapadmin/templates/creation/
fi

exit 0

More info https://github.com/osixia/docker-light-baseimage#startupsh

tomdaley92 commented 3 years ago

Thank you @Vsevo1od your solution worked perfectly for me 👍