Sign inSign up

jfusterm/wp-packer

By jfusterm

•Updated over 10 years ago

Wordpress image built using Packer

Image
0

1.9K

jfusterm/wp-packer repository overview

⁠Tags & JSON file

⁠Description

This image was built using Packer⁠ and Ansible⁠ instead of a Dockerfile. Using a jfusterm/ansible⁠ as a base image, the following applications were installed using Ansible and committed to a Docker images via Packer:

  • Nginx
  • PHP-FPM with OPcache support
  • Wordpress
  • Supervisor

Wordpress is installed under /usr/share/nginx/html/wordpress.

⁠Usage

This image is perfect for testing/learning purposes and can be used with more or less built-in automation.

⁠Basic

You can start a standalone Wordpress container using:

$ docker run -d --name my-wordpress -p 80:80 jfusterm/wp-packer:4.5 supervisord

Now you can open the URL and finish the configuration pointing to your existing MySQL database.

⁠Advanced

You can use this environment variables to configure the DB connection parameters automatically:

  • WORDPRESS_DB_HOST
  • WORDPRESS_DB_USER
  • WORDPRESS_DB_PASSWORD
  • WORDPRESS_DB_NAME
$ docker run -d --name my-wordpress -p 80:80 \
  -e WORDPRESS_DB_HOST=192.168.42.10 \
  -e WORDPRESS_DB_USER=wordpress \
  -e WORDPRESS_DB_PASSWORD=Qwerty12345- \
  -e WORDPRESS_DB_NAME=wordpressdb \
  --entrypoint /entrypoint.sh jfusterm/wp-packer:4.5 supervisord

To ensure that the wp-config.php file is generated with the proper parameters the entrypoint of the image should be the entrypoint.sh⁠ script using --entrypoint /entrypoint.sh

The best way to set up the testing/learning containers is using a docker-compose.yml file.

version: '2'
services:
  wordpress:
    image: jfusterm/wp-packer:4.5
    container_name: my-wordpress
    ports:
    - "80:80"
    - "443:443"
    volumes:
    - wp_code:/usr/share/nginx/html/wordpress
    depends_on:
    - mysql
    entrypoint: /entrypoint.sh
    command: supervisord
    environment:
      WORDPRESS_DB_HOST: "mysql"
      WORDPRESS_DB_USER: "root"
      WORDPRESS_DB_PASSWORD: "Qwerty12345-"
      WORDPRESS_DB_NAME: "wordpressdb"
    links:
    - mysql
    networks:
    - wp_net
  mysql:
    image: mysql:5.7
    container_name: my-wordpressdb
    ports:
    - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: "Qwerty12345-"
      MYSQL_DATABASE: "wordpressdb"
    volumes:
    - wp_db:/var/lib/mysql
    networks:
    - wp_net

networks:
  wp_net:
    driver: bridge

volumes:
   wp_code:
   wp_db:

To start both containers just:

$ docker-compose up -d

Tag summary

Content type

Image

Digest

Size

47 MB

Last updated

over 10 years ago

docker pull jfusterm/wp-packer:4.5