This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ jobs: | |
matrix: | ||
context: | ||
- all-in-one | ||
- nginx | ||
- php | ||
|
||
steps: | ||
- name: Checkout repository | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: WordPress | ||
|
||
networks: | ||
wordpress: | ||
driver: bridge | ||
|
||
volumes: | ||
db_data: {} | ||
wordpress_data: {} | ||
|
||
services: | ||
db: | ||
image: mariadb:lts | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: somewordpress | ||
MYSQL_DATABASE: wordpress | ||
MYSQL_USER: wordpress | ||
MYSQL_PASSWORD: wordpress | ||
networks: | ||
- wordpress | ||
|
||
nginx: | ||
build: | ||
context: nginx | ||
depends_on: | ||
- php | ||
ports: | ||
- "8080:80" | ||
networks: | ||
- wordpress | ||
volumes: | ||
- wordpress_data:/var/www/html/wp-content | ||
|
||
php: | ||
build: | ||
context: php | ||
depends_on: | ||
- db | ||
networks: | ||
- wordpress | ||
volumes: | ||
- wordpress_data:/var/www/html/wp-content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG NGINX_VERSION=1.26.2 | ||
FROM nginx:${NGINX_VERSION}-alpine | ||
|
||
# Install nginx | ||
RUN mkdir -p /etc/nginx/snippets | ||
COPY fastcgi-php.conf /etc/nginx/snippets/fastcgi-php.conf | ||
COPY default.conf /etc/nginx/conf.d/default.conf | ||
|
||
WORKDIR /var/www/html | ||
|
||
# Download WordPress | ||
ARG WORDPRESS_VERSION=latest | ||
RUN curl -o /tmp/wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz" | ||
RUN tar -xzf /tmp/wordpress.tar.gz -C /var/www/html --strip-components=1 | ||
RUN rm -f /tmp/wordpress.tar.gz | ||
RUN chmod -R 755 /var/www/html | ||
RUN chown -R nginx:nginx /var/www/html | ||
|
||
EXPOSE 80 | ||
|
||
ENTRYPOINT ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
upstream php { | ||
server php:9000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
root /var/www/html; | ||
|
||
index index.php index.html index.htm; | ||
|
||
# Access log | ||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
|
||
location = /favicon.ico { | ||
log_not_found off; | ||
access_log off; | ||
} | ||
|
||
location = /robots.txt { | ||
allow all; | ||
log_not_found off; | ||
access_log off; | ||
} | ||
|
||
location / { | ||
# This is cool because no php is touched for static content. | ||
# include the "?$args" part so non-default permalinks doesn't break when using query string | ||
try_files $uri $uri/ /index.php?$args; | ||
} | ||
|
||
location /healthcheck { | ||
return 200 'healthy'; | ||
} | ||
|
||
# PHP-FPM configuration | ||
location ~ \.php$ { | ||
include snippets/fastcgi-php.conf; | ||
fastcgi_pass php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
# Deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
location ~ /\.ht { | ||
deny all; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_index index.php; | ||
include fastcgi_params; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
ARG PHP_VERSION=8.0 | ||
FROM php:${PHP_VERSION}-fpm | ||
|
||
# Install PHP extensions | ||
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ | ||
ARG PHP_EXTENSIONS="gd opcache zip pdo_mysql mysqli redis xdebug imagick exif mbstring zip" | ||
RUN install-php-extensions ${PHP_EXTENSIONS} | ||
|
||
RUN echo "opcache.enable=1" >> /usr/local/etc/php/conf.d/opcache.ini | ||
RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/opcache.ini | ||
RUN echo "opcache.memory_consumption=256" >> /usr/local/etc/php/conf.d/opcache.ini | ||
RUN echo "memory_limit=2048M" >> /usr/local/etc/php/conf.d/performance.ini | ||
RUN echo "upload_max_filesize=100M" >> /usr/local/etc/php/conf.d/performance.ini | ||
RUN echo "post_max_size=100M" >> /usr/local/etc/php/conf.d/performance.ini | ||
|
||
# Download WordPress | ||
ARG WORDPRESS_VERSION=latest | ||
RUN curl -o /tmp/wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz" | ||
RUN tar -xzf /tmp/wordpress.tar.gz -C /var/www/html --strip-components=1 | ||
RUN rm -f /tmp/wordpress.tar.gz | ||
RUN chmod -R 755 /var/www/html | ||
RUN chown -R www-data:www-data /var/www/html | ||
|
||
EXPOSE 9000 | ||
|
||
WORKDIR /var/www/html | ||
|
||
ENTRYPOINT ["php-fpm", "-F"] |