I hope you all familiar with Docker? =)))

https://www.docker.com/

Tbh docker is a bit complicated for me still, but I will give it a hard try now, because, mastering containers can lead to mastering orchestration and all that stuff. And there is still a lot of potential in scaling and integrating everywhere you could.

So first of all thx Linux - it's native there! Windows and Macs are using virtualisation. You can pull all kind of containers from hub. And compose yours, then commit them and push, or make some stacks.

Let's try make some Wordpress site out of 1 container - and then put there some content - wrap it up - push to our hub or even Azure container service. And later pickit and launch on different docker and see all content that was there b4 =P

It's also would be nice to have some ssl from Let'sEncrypt at least - because nowdays no ssl suck like hell ^_^

So - doing Wp is quite easy, but either I'm blind or nobody puts mySql or Maria along... Here are some docker shit.

compose and Dockerfile - it's like installer and config

docker-compose.yml

version: '2'
services:
db:
image: mariadb:10.3
volumes:
- "db-data:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress

wordpress:
depends_on:
- db
build: ./
volumes:
- "site-data:/var/www/wp-content"
ports:
- "80:80"
environment:
DB_HOST: db
DB_PASSWORD: wordpress
DB_NAME: wordpress
DB_USER: wordpress
WORDPRESS_SITE_URL: http://localhost
FS_METHOD: direct
# For debugging only:
#WP_DEBUG: "true"
#WP_DEBUG_DISPLAY: "true"

volumes:
db-data:
site-data:

networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.91.0/24

Dockerfile

FROM alpine:3.8
LABEL Maintainer="Tim de Pater code@trafex.nl"
Description="Lightweight WordPress container with Nginx 1.14 & PHP-FPM 7.2 based on Alpine Linux."

Install packages from testing repo's

RUN apk --no-cache add php7 php7-fpm php7-mysqli php7-json php7-openssl php7-curl
php7-zlib php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-xmlwriter
php7-simplexml php7-ctype php7-mbstring php7-gd nginx supervisor curl bash less

Configure nginx

COPY config/nginx.conf /etc/nginx/nginx.conf

Configure PHP-FPM

COPY config/fpm-pool.conf /etc/php7/php-fpm.d/zzz_custom.conf
COPY config/php.ini /etc/php7/conf.d/zzz_custom.ini

Configure supervisord

COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

wp-content volume

VOLUME /var/www/wp-content
WORKDIR /var/www/wp-content
RUN chown -R nobody.nobody /var/www

WordPress

ENV WORDPRESS_VERSION 4.9.8
ENV WORDPRESS_SHA1 0945bab959cba127531dceb2c4fed81770812b4f

RUN mkdir -p /usr/src

Upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress

RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -
&& tar -xzf wordpress.tar.gz -C /usr/src/
&& rm wordpress.tar.gz
&& chown -R nobody.nobody /usr/src/wordpress

Add WP CLI

RUN curl -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
&& chmod +x /usr/local/bin/wp

WP config

COPY wp-config.php /usr/src/wordpress
RUN chown nobody.nobody /usr/src/wordpress/wp-config.php && chmod 640 /usr/src/wordpress/wp-config.php

Append WP secrets

COPY wp-secrets.php /usr/src/wordpress
RUN chown nobody.nobody /usr/src/wordpress/wp-secrets.php && chmod 640 /usr/src/wordpress/wp-secrets.php

Entrypoint to copy wp-content

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

EXPOSE 80

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

docker run -d -p 80:80 -v /local/folder:/var/www/wp-content
-e "DB_HOST=db"
-e "DB_NAME=wordpress"
-e "DB_USER=wp"
-e "DB_PASSWORD=secret"
-e "FS_METHOD=direct"
trafex/wordpress

And we got some containers here - Jenkins is ok at ports...

Wordpress is at 80 but say we got no DB connect

we keep on investigating

UDP1

So ... Main point is that container can be adjusted, but you have to either get a vault ( like an hdd external drive for your data) or commit changes to docker image ... Scratch that wordpress for a while, and check Jenkins and patches to do the job.

After the commit you should do docker push to push it to the cloud. So basically you can do a nice, tuned docker container with Jenkins and then commit/push to store it in your hub.docker - and then... it will be like a reusable instance that you can bring up anywhere using docker and get all tuned instance of linux and Jenkins ready to go with all your preconfigured stuff... That's sound really awesome to me !!!

So let's check it out on Azure  -_-

I did commit and push - so let's try to delete and pull