Extending base WordPress docker image to download latest wp-content folder - wordpress

I'm trying to extend a base WordPress image (https://github.com/docker-library/wordpress/blob/b807f1285869a220a5f72b935901603e5bde8822/php5.6/apache/Dockerfile)
I basically create a script in the Docker file that I want to execute when the container starts up to download the latest wp-content folder.
The base image has the following:
ENTRYPOINT ["docker-entrypoint.sh"] CMD ["apache2-foreground"]
I'm new to Docker so thought I could add the following to my extended docker file in order to overwrite the wp-content folder:
CMD /application/getwebsitecontent
Where getwebsitecontent is just a script to pull down the folder. The script works fine.
The problem is if I do this, it seems to override the command in the base image so I end up with no WordPress install. How do I ensure that both ENTRYPOINT and CMD are run from the base and then extend with my own script?
I'm trying to achieve the latest website content being downloaded from backup location on each container start.

When you overwrite the entry point the original will not work. What you need to do when using your own entry point I that you need to copy everything from the old one into to the new you created. You can see it's content in github repository or when you run it locally and browse it's contents

Related

how to delete an image from nexus along with the directory

As part of our CI,we are uploading a temporary docker image by creating a temporary folder.
our requirement is to delete the entire folder along with artifact from nexus after the end of the pipeline and for this we are using command
DELETE /service/rest/v1/components/{id}
but the above command is only deleting the artifact not the complete folder.
COuld anyone assist me on this?

How do I change file permissions on ElasticBeanstalk before docker image gets built?

I am deploying a Docker image (Wordpress) on Elastic Beanstalk using a single container deployment.
My deployment zip file includes:
public folder containing a complete wordpress build
Dockerfile
.ebextensions/permissions.config
The standard Wordpress image creates a volume VOLUME /var/www/html and in my Dockerfile I do
COPY ./public /var/www/html
Now the problem is that I cannot upload media using Wordpress admin dashboard.
Unable to create directory wp-content/uploads/2019/02. Is its parent directory writable by the server?
I've tried to change the permissions on the uploads folder using the EB config in .ebextensions/permissions.config
container_commands:
91writable_dirs:
command: |
chmod -R 777 /var/app/current/public/wp-content/uploads
cwd: "/var/app/current"
I see from the logs that the docker image gets built before running chmod. I've seen on other SO posts that some run the script on /var/app/ondeck/, but that fails with the directory doesn't exist
Despite all the above, my question is actually how do I get to upload media to Wordpress with my current setup.
EDIT: When I attach a shell to the docker container and change the file permissions of wp-content/uploads in the VOLUME /var/www/html I am able to upload media. So how can this be made permanent on the VOLUME?
Whenever wordpress docker image is built and run, the docker ENTRYPOINT of the wordpress image is executed first. Hence your command to change the directory permissions is not getting executed.
This ENTRYPOINT is a bash script located in /usr/local/bin/docker-entrypoint.sh
If you want your command to be executed, you could add your command to this script and it will be called every time your container starts.
You could do it the following way -
Start your container and copy the contents of the existing
docker-entrypoint.sh
Create a new docker-entrypoint.sh outside the container and edit
that script to add your chmod command at appropriate location.
In your Dockerfile add a line to copy this new entrypoint to the
location /usr/local/bin/docker-entrypoint.sh

How to develop in Wordpress with Docker?

I have a docker container with installed WP and I want to create a new custom theme for it, but I don't want to install wp on own machine. Can I develop a new theme only via Docker container?
UDP:
I solved my problem in this way:
1) in docker-composer.yml in a wordpress field need create a field
volumes:
- ./wordpress:/var/www/html
2) Create in your file system the directory wordpress and run docker-compose build and then docker-compose up. Files will be moved in your directory and you can work with them and see a result in localhost.
you can try to login into container (make sure it is running) using following command
#>docker exec -it <container-name-or-id> sh
After that you can edit and create themes inside this container.

Change Meteor Up start.sh template

Due to install Graphicsmagick at Meteor Up Docker, I need to edit the start.sh (link this: Meteor Up Docker and Graphicsmagick).
I done that at the server and works, but every time I run mupx deploy, my /opt/<appName>/config/start.sh file change to original. I need to change the start.sh template, but I don't know how to do that, how can I change it?
You have to change the file from your local meteor-up template. not sure about mupx, it might be in your global .npm installation folder.
I'm using kadira meteor-up so mine is located at the git cloned folder.

How to clone WordPress theme from github

I've been developing a wordpress theme on a dev site, and all along I've been pushing it to github. It's now ready to be deployed to my live site, but I'm not sure how to do that.
What I've tried so far (that didn't work) is creating an empty /wp-content/themes/my-theme/ directory on my live site, and I cd into it. Then I use git clone git#github.com:path/to/my-theme.git but that creates another directory inside of my my-theme/ directory with all of the theme files inside of it. To clarify, that now creates:
/wp-content/themes/my-theme/my-theme/[all theme files here]
But I just want the files from the github repo to be placed directly into the original empty my-theme directory that I created.
try git clone <repo> . -- you can specify the directory as the last argument.

Resources