Skip to content

Instantly share code, notes, and snippets.

@wolf0403
Created September 26, 2014 05:42
Show Gist options
  • Save wolf0403/2d859908c1d1d00d66ef to your computer and use it in GitHub Desktop.
Save wolf0403/2d859908c1d1d00d66ef to your computer and use it in GitHub Desktop.
Dockerfile for simple Wordpress with SQLite.
# Originally from: http://dustymabe.com/2014/05/10/zero-to-wordpress-on-docker-in-5-minutes/
FROM goldmann/f20
MAINTAINER Dusty Mabe
# Install httpd and update openssl
RUN rpm -Uvh http://kojipkgs.fedoraproject.org//packages/yum/3.4.3/120.fc20/noarch/yum-3.4.3-120.fc20.noarch.rpm
RUN yum update -y
RUN yum install -y httpd openssl unzip php php-pdo wget
# Download and extract wordpress
RUN wget http://wordpress.org/latest.tar.gz -O wordpress.tar.gz
RUN tar -xzvf wordpress.tar.gz --strip-components=1 --directory /var/www/html/
RUN rm wordpress.tar.gz
# Download plugin to allow WP to use sqlite
# http://wordpress.org/plugins/sqlite-integration/installation/
# - Move sqlite-integration folder to wordpress/wp-content/plugins folder.
# - Copy db.php file in sqlite-integratin folder to wordpress/wp-content folder.
# - Rename wordpress/wp-config-sample.php to wordpress/wp-config.php.
#
RUN wget http://downloads.wordpress.org/plugin/sqlite-integration.1.6.3.zip -O sqlite-plugin.zip
RUN unzip sqlite-plugin.zip -d /var/www/html/wp-content/plugins/
RUN rm sqlite-plugin.zip
RUN cp /var/www/html/wp-content/{plugins/sqlite-integration/db.php,}
RUN cp /var/www/html/{wp-config-sample.php,wp-config.php}
#
# Fix permissions on all of the files
RUN chown -R apache /var/www/html/
RUN chgrp -R apache /var/www/html/
#
# Update keys/salts in wp-config for security
RUN
RE='put your unique phrase here';
for i in {1..8}; do
KEY=ltgvtjJQjC6jhfpIaah7xFgxjxurdDlxO9mvvYAo5N/2t8f+YAtiPA==;
sed -i "0,//s|||" /var/www/html/wp-config.php;
done;
#
# Expose port 80 and set httpd as our entrypoint
EXPOSE 80
ENTRYPOINT ["/usr/sbin/httpd"]
CMD ["-D", "FOREGROUND"]
# Original content was based on an old version of docker. As I test on docker 1.2 the above entrypoint
# may not work properly, so it's necessary to start the container manually as
# sudo docker run -d -p 8090:80 -t c761a9ad716b /usr/sbin/httpd -D FOREGROUND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment