Giter VIP home page Giter VIP logo

alpine-php-wordpress's Introduction

Wordpress Container image running on Alpine Linux

Docker Automated build Docker Pulls Docker Stars

Alpine Version Wordpress Version

This Container image (yobasystems/alpine-php-wordpress) is based on the minimal Alpine Linux ready for running WordPress. (Requires external database)

Alpine Version 3.19.1 (Released 2023-01-26)

Wordpress Version latest
PHP Version 8.1.28
Nginx Version 1.24.0

Table of Contents

๐Ÿ”๏ธ What is Alpine Linux?

Alpine Linux is a Linux distribution built around musl libc and BusyBox. The image is only 5 MB in size and has access to a package repository that is much more complete than other BusyBox based images. This makes Alpine Linux a great image base for utilities and even production applications. Read more about Alpine Linux here and you can see how their mantra fits in right at home with Container images.

What is Wordpress?

WordPress is an online, open source website creation tool written in PHP. But in non-geek speak, it's probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.

โœจ Features

  • Minimal size only, minimal layers
  • Memory usage is minimal on a simple install.

๐Ÿ—๏ธ Architectures

  • :amd64, :x86_64 - 64 bit Intel/AMD (x86_64/amd64)
  • :arm64v8, :aarch64 - 64 bit ARM (ARMv8/aarch64)
  • :arm32v7, :armhf - 32 bit ARM (ARMv7/armhf)

๐Ÿ“ PLEASE CHECK TAGS BELOW FOR SUPPORTED ARCHITECTURES, THE ABOVE IS A LIST OF EXPLANATION

๐Ÿท๏ธ Tags

  • :latest latest branch based (Automatic Architecture Selection)
  • :amd64, :x86_64 amd64 based on latest tag but amd64 architecture
  • :aarch64, :arm64v8 Armv8 based on latest tag but arm64 architecture
  • :armhf, :arm32v7 Armv7 based on latest tag but arm32 architecture

๐Ÿ“ Layers & Sizes

Version MicroBadger Layers (tag) MicroBadger Size (tag)

Version MicroBadger Layers (tag) MicroBadger Size (tag)

Version MicroBadger Layers (tag) MicroBadger Size (tag)

Volume structure

  • /usr/html: Webroot

๐Ÿš€ How to use this image

Creating an instance

Make sure you create the folder on the host before starting the container and obtain the correct permissions.

mkdir -p /data/{domain}/html

docker run -e VIRTUAL_HOST={domain}.com,www.{domain}.com -v /data/{domain}/html:/usr/html -p 80:80 yobasystems/alpine-php-wordpress

E.G

mkdir -p /data/yobasystems/html

docker run -e VIRTUAL_HOST=yobasystems.co.uk,www.yobasystems.co.uk -v /data/yobasystems/html:/usr/html -p 80:80 yobasystems/alpine-php-wordpress

The following user and group id are used, the files should be set to this: User ID: Group ID:

chown -R 100:101 /data/{domain}/html

E.G

chown -R 100:101 /data/yobasystems/html

Populate /data/{domain}/html with your WP files.

The following user and group id are used, the files should be set to this:

User ID:

Group ID:

chown -R 100:101 /data/{domain}/html

WP-CLI

This image now includes WP-CLI wpcli.org baked in... Its best to su nginx before executing anything or else you can potentially compromise your host.

docker exec -it <container_name> bash
su nginx
cd /usr/html
wp-cli core download --locale=en_GB

Redis Cache

Edit the wp-config.php file and include the line;

define('WP_REDIS_HOST', 'redis');

The next thing is to install the plugin Redis Object Cache

SSL behind a proxy

If using SSL and running behind a proxy like HAproxy then the following needs to be added to the wp-config.php file (to stop infinite redirect);

define('FORCE_SSL_ADMIN', true);
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
   $_SERVER['HTTPS']='on';

Upload limit

The upload limit is 128 Megabytes.

Change php.ini value

modify files/php-fpm.conf

To modify php.ini variable, simply edit php-fpm.ini and add php_flag[variable] = value.

php_flag[display_errors] = on

PHP Modules

List of available modules in Alpine Linux, not all these are installed.

In order to install a php module do, (leave out the version number i.e. -5.6.11-r0
docker exec <image_id> apk add <pkg_name>
docker restart <image_name>

Example:

docker exec <image_id> apk add php81-soap
docker restart <image_name>
php81-common
php81-pdo_sqlite
php81-pear
php81-ftp
php81-imap
php81-mysqli
php81-json
php81-mbstring
php81-soap
php81-litespeed
php81-sockets
php81-bcmath
php81-opcache
php81-dom
php81-zlib
php81-gettext
php81-fpm
php81-intl
php81-openssl
php81-session
php81-pdo_mysql
php81-embed
php81-xmlrpc
php81-wddx
php81-dba
php81-ldap
php81-xsl
php81-exif
php81-pdo_dblib
php81-bz2
php81-pdo
php81-pspell
php81-sysvmsg
php81-gmp
php81-apache2
php81-pdo_odbc
php81-shmop
php81-ctype
php81-phpdbg
php81-enchant
php81-sysvsem
php81-sqlite3
php81-odbc
php81-pcntl
php81-calendar
php81-xmlreader
php81-snmp
php81-zip
php81-posix
php81-iconv
php81-curl
php81-doc
php81-gd
php81-xml
php81-dev
php81-cgi
php81-sysvshm
php81-pgsql
php81-tidy
php81-pdo_pgsql
php81-phar
php81-mysqlnd

Docker Compose example:

wordpress:
  image: yobasystems/alpine-php-wordpress
  environment:
    VIRTUAL_HOST: example.co.uk
  expose:
    - "80"
  volumes:
    - /data/example/www:/usr/html
  restart: always
  links:
    - mysql:mysql
mysql:
  environment:
    MYSQL_DATABASE: wordpressdb
    MYSQL_PASSWORD: wordpresspass
    MYSQL_ROOT_PASSWORD: ''
    MYSQL_USER: wordpressuser
  image: yobasystems/alpine-mariadb

๐Ÿ” Image contents & Vulnerability analysis

PACKAGE NAME PACKAGE VERSION VULNERABILITIES

๐Ÿ“š Source Repositories

๐Ÿณ Container Registries

๐Ÿ”— Links

๐Ÿ’ฐ Donation

BMAC

BITCOIN

ETHEREUM

alpine-php-wordpress's People

Contributors

dominictayloruk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

alpine-php-wordpress's Issues

curl 6 error

i am running behinf traefik. iedit wp-config.php as you guys said running ubuntu 18.04
docker swarm.
after deploy your stack i got

Unable to reach WordPress.org at wordpress.org: cURL error 6: Could not resolve host: wordpress.org

directory index of "/usr/html/" is forbidden

what is the correct user ID and group ID I should use?

I tried this one:
The following user and group id are used, the files should be set to this: User ID: Group ID:

chown -R 100:101 /data/{domain}/html

E.G

chown -R 100:101 /data/yobasystems/html

it returned directory index of "/usr/html/" is forbidden.

then I tried set to my user ID which created the folder. failed as well.

Duplicate dependency install

[RESOLVED] curl6 error

if somebody wanna run this image behind a loadbalancer like traefik 1.7.5 and backed by a swarm cluster:
create a overlay network like below:

docker network create
--driver overlay
--subnet 10.0.9.0/24
--gateway 10.0.9.254
net

deploy traefik following:

docker service create -d --name loadbalancer
--restart-condition any
--replicas 1
--update-delay 2s
--constraint=node.role==manager
--publish 80:80
--publish 443:443
--publish 9090:8080
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock
--mount type=bind,source=/mnt/efs/traefik/certs,target=/etc/traefik/certs
--mount type=bind,source=/mnt/efs/traefik/traefik.toml,target=/etc/traefik/traefik.toml
--network net
traefik:latest
--docker
--docker.swarmmode
--docker.watch
--web
--loglevel=DEBUG

traefik.toml

defaultEntryPoints = ["http", "https"]

[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
permanent = true
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = "/etc/traefik/certs/domain.com.crt"
keyFile = "/etc/traefik/certs/domain.com.key"

deploy yobasystems/alpine-php-wordpress under same overlay network "net"
thanks dominic create this wonderful image
everything very modular and beginner friendly
with this base image you can handle 100-150 concurrent user
with pagespeed, varnish, wp supercache (8000-8500) concurrent in a single EC2
working on it
i will publish a optimized image based on this image using pagespeed,varnish,wp supercache

add following (nginx specified) top of the wp-config:

define('FORCE_SSL_ADMIN', true);
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

otherwise your site will be loaded without style css and js

PS:
can i just install varnish 5 using:
apk add varnish
can i add:
varnishd -f /etc/varnish/default.vcl -s malloc,64M -a 0.0.0.0:80

to /run.sh

expecting:
varnish,nginx, php-fpm will boot upon container startup based on your infra??

to do:
add wp supercache with pagespeed (working on it)
Thanks

curl6 error

i test your stack on a docker swarm cluster behind traefik. before october everything was fine.
new update returns a curl6 error. wordpress admin seems slow using redis

traefik.toml

defaultEntryPoints = ["http", "https"]

[entryPoints]
[entryPoints.http]
address = ":80"
compress = true

Uncomment the following two lines to redirect HTTP to HTTPS.

[entryPoints.http.redirect]
entryPoint = "https"
regex = "^http://localhost/(.*)"
replacement = "http://mydomain.com/$1"
permanent = true

[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = "/etc/traefik/certs/mydomain.com.crt"
keyFile = "/etc/traefik/certs/mydomain.com.key"

traefik deploy

docker service create -d --name loadbalancer
--restart-condition any
--replicas 1
--update-delay 2s
--constraint=node.role==manager
--publish 80:80
--publish 443:443
--publish 9090:8080
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock
--mount type=bind,source=/mnt/efs/traefik/certs,target=/etc/traefik/certs
--mount type=bind,source=/mnt/efs/traefik/traefik.toml,target=/etc/traefik/traefik.toml
--network net
iloveuodi/traefik:v1.7.4-alpine
--docker
--docker.swarmmode
--docker.watch
--web
--loglevel=DEBUG

yobasystems stack

docker service create -d --name wordpress
--hostname wordpress
--limit-cpu 0.000
--limit-memory 170M
--reserve-memory 30M
--restart-condition any
--replicas 1
--update-delay 2s
--update-parallelism 1
--update-failure-action continue
--restart-max-attempts 1
--constraint=node.role==worker
--publish 8080:80
--label="traefik.frontend.headers.STSSeconds=15768000"
--label="traefik.docker.network=net"
--label="traefik.port=80"
--label="traefik.frontend.rule=PathPrefix:/"
--label="traefik.backend.loadbalancer.sticky=true"
--mount type=bind,source=/mnt/efs/data/v1/html,target=/usr/html
-e VIRTUAL_HOST=mydomain.com,www.mydomain.com
--network net
iloveuodi/alpine-php-wordpress:cache

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.