Sign inSign up

mangeot/wordpress-autodeploy

By mangeot

•Updated over 2 years ago

Wordpress image to automagically deploy a theme

Image
0

161

mangeot/wordpress-autodeploy repository overview

⁠Use this compose.yaml in order to autodeploy your wordpress theme

    # We use a mariadb image which supports both amd64 & arm64 architecture
    #image: mariadb:10.6.4-focal
    image: mariadb:latest
    # If you really want to use MySQL, uncomment the following line
    #image: mysql:8.0.27
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      #- MYSQL_ROOT_PASSWORD=somewordpress
      - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
        #- MYSQL_RANDOM_ROOT_PASSWORD=yes
        # La valeur se lit dans les logs du container au démarrage
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=wordpress
        #- MYSQL_PASSWORD=wordpress
      - MYSQL_PASSWORD_FILE=/run/secrets/db_password
    # Pour lancer une image après l'autre, soit on ajoute un sleep, soit on rajoute un healthcheck
    # Et on l'attend pour lancer l'autre image 
    healthcheck:
      test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
      start_period: 1m
      start_interval: 10s
      interval: 1m
      timeout: 5s
      retries: 3
    secrets:
      - db_root_password
      - db_password

  wordpress:
    #image: wordpress:latest
    image: mangeot/wordpress-autodeploy
    ports:
      - 8555:80
    restart: always
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=wordpress
        #- WORDPRESS_DB_PASSWORD=wordpress
      - WORDPRESS_DB_PASSWORD_FILE=/run/secrets/db_password
      - WORDPRESS_DB_NAME=wordpress
    volumes:
      - wordpress:/var/www/html
    secrets:
      - db_password

  phpmyadmin:
    image: phpmyadmin
    restart: always
    depends_on:
      - db
    ports:
      - 8080:80
    environment:
      - PMA_ARBITRARY=1

  wpcli:
    image: wordpress:cli
    # This is required to run wordpress-cli with the same
    # user-id as wordpress. This way there are no permission problems
    # when running the cli
    user: xfs
    depends_on:
      db:
        condition: service_healthy
      wordpress:
        condition: service_healthy
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=wordpress
        #- WORDPRESS_DB_PASSWORD: password
      - WORDPRESS_DB_PASSWORD_FILE=/run/secrets/db_password
      - WORDPRESS_DB_NAME=wordpress
    restart: no
      #    command: "user create new_admin [email protected] --role=administrator --user_pass=Pa55w0rd --allow-root && theme activate didactique --allow-root"
      #command: "wp core install --title='My Site' --admin_user=admin --admin_password=Pa55w0rd [email protected] --allow-root --url=http://localhost:8555 --skip-themes ; sleep 10 ; wp theme activate didactique --allow-root"
    command: >
      /bin/sh -c '
      sleep 10;
      wp core install --title="My Site" --admin_user=admin --admin_password=Pa55w0rd [email protected] --allow-root --url=http://localhost:8555 --skip-themes ; 
      sleep 10; 
      wp theme activate didactique --allow-root;
      sleep 10; 
      wp core update;
      sleep 10; 
      wp plugin install oauth2-provider --activate
      sleep 10; 
      wp plugin install miniorange-saml-20-single-sign-on --activate
      '
    volumes_from:
      - wordpress:rw
    secrets:
      - db_password

volumes:
  db_data:
  wordpress:

secrets:
  db_root_password:
    file: ./db_root_password.txt
  db_password:
    file: ./db_password.txt

Tag summary

Content type

Image

Digest

sha256:a19532fa1…

Size

274.1 MB

Last updated

over 2 years ago

docker pull mangeot/wordpress-autodeploy