markdown-blog icon indicating copy to clipboard operation
markdown-blog copied to clipboard

Adding a docker file to run the project

Open wgwz opened this issue 4 years ago • 4 comments

In case you're interested in adding this:

$ cat Dockerfile 
FROM php:7.2-apache
COPY markdown-blog/ /var/www/html/
RUN a2enmod rewrite
RUN echo "RewriteEngine On" >> /etc/apache2/apache2.conf

Then:

docker build -t my-php-app .
docker run -it -p 80:80 my-php-app

PHP docker docs: https://hub.docker.com/_/php

Been shopping around for blog stuff and came on to your project. I like it! Hope you find this helpful. Could be a good way to advertise it for users who are interested in trying it out but not too familiar with PHP.

wgwz avatar Oct 27 '20 23:10 wgwz

Thanks a lot for creating a docker file!

I will test it and see how it goes, then I will add it to the project. I think it's useful for testing. The main goal of the blog was to be integrated into existing PHP sites, but I guess it can also be used as a simple standalone blogging platform, thus a docker image could be helpful.

I am not that familiar with docker, can you change files in the container after the image is built? I assume you can still SSH to it and change stuff.

Cristy94 avatar Oct 29 '20 01:10 Cristy94

If you wanted something like that the best way to go about it would be a volume mount, where any modifications you make on the local files, will be present inside the container. Whether or not you would need to reload apache to get the updates for the PHP files, I’m unsure because I really don’t know how that part works. But if the usual thing is for you to just edit those php files and apache automatically picks up changes, a volume mount is the way to go. You could connect to the container and make edits inside of it, but that’s really not the model of use for docker. I can put together a example with a volume mount. It’s really nothing more than command line flags when you run docker, the Dockerfile stays the same.

Definitely useful for testing!

wgwz avatar Oct 29 '20 01:10 wgwz

Just a quick update, I recently learned the basics of Docker (to add Docker support for userTrack) and I will soon create a Docker image for the Blog too.

One issue with an image is that currently the blog is not a complete platform (no themes, no default structure), so I might have to create and add a default template before creating the image.

Cristy94 avatar Jan 27 '21 20:01 Cristy94

From my perspective, I don’t think themes and all that are necessary. Perhaps some suggestions towards how to structure the blog would be helpful in the README. But I would aim to keep it fairly flexible. I’m totally fine with a system the ships with little style and other stuff. Just my 2 cents :-)

wgwz avatar Jan 30 '21 01:01 wgwz