Skip to content

Instantly share code, notes, and snippets.

@azibom
Last active November 23, 2023 19:45
Show Gist options
  • Save azibom/5960f2546cc73e8a1ad27b5cff05de10 to your computer and use it in GitHub Desktop.
Save azibom/5960f2546cc73e8a1ad27b5cff05de10 to your computer and use it in GitHub Desktop.
# WordPress Dockerfile: Create container from official WordPress image, basic customizations.
# docker build -t wordpress_local:wp_custom_1.0 .

FROM wordpress:latest

# APT Update/Upgrade, then install packages we need
RUN apt update && \
    apt upgrade -y && \
    apt autoremove && \
    apt install -y \
    vim \
    wget \
    mariadb-client

# Replace php.ini
COPY php.ini /usr/local/etc/php

# Install WP-CLI
RUN wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
    php wp-cli.phar --info&& \
    chmod +x wp-cli.phar && \
    mv wp-cli.phar /usr/local/bin/wp && \
    # Remove old php.ini files (wihtout creating new image)
    rm /usr/local/etc/php/php.ini-development && \
    rm /usr/local/etc/php/php.ini-production

# Copy the project to the image
COPY . /var/www/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment