This repository was 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
125 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
# wordpress-container | ||
# wordpress container | ||
|
||
A simple container for running a wordpress site. |
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,33 @@ | ||
FROM php:8.0-fpm | ||
|
||
# Install dependencies | ||
RUN apt update && apt upgrade -y | ||
|
||
# Install supervisor | ||
RUN apt install -y supervisor | ||
|
||
# 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 redis xdebug imagick exif mbstring" | ||
RUN install-php-extensions ${PHP_EXTENSIONS} | ||
|
||
COPY supervisor/php-fpm.conf /etc/supervisor/conf.d/php-fpm.conf | ||
|
||
# Install nginx | ||
COPY install-nginx.sh /tmp/install-nginx.sh | ||
RUN chmod +x /tmp/install-nginx.sh | ||
RUN /tmp/install-nginx.sh | ||
RUN rm -f /tmp/install-nginx.sh | ||
|
||
COPY default.conf /etc/nginx/conf.d/default.conf | ||
COPY supervisor/nginx.conf /etc/supervisor/conf.d/nginx.conf | ||
|
||
# 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 | ||
|
||
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"] |
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,46 @@ | ||
upstream php { | ||
server unix:/var/run/php/php8.0-fpm.sock; | ||
} | ||
|
||
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; | ||
} | ||
|
||
# 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,30 @@ | ||
#!/bin/sh | ||
|
||
# Install the prerequisites (if not already included in the base image) | ||
apt update && apt install -y curl gnupg2 ca-certificates lsb-release debian-archive-keyring | ||
|
||
# Import an official nginx signing key so apt could verify the packages authenticity. | ||
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \ | ||
> /usr/share/keyrings/nginx-archive-keyring.gpg | ||
|
||
# Verify that the downloaded file contains the proper key | ||
gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg | ||
# The output should contain the full fingerprint 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 | ||
|
||
# Set up the apt repository for stable nginx packages | ||
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \ | ||
http://nginx.org/packages/debian `lsb_release -cs` nginx" \ | ||
> /etc/apt/sources.list.d/nginx.list | ||
|
||
# Set up repository pinning to prefer our packages over distribution-provided ones | ||
echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \ | ||
> /etc/apt/preferences.d/99nginx | ||
|
||
# Update the package lists | ||
apt update | ||
|
||
# Install nginx | ||
apt install -y nginx | ||
|
||
# Clean up to reduce the image size | ||
apt clean && rm -rf /var/lib/apt/lists/* |
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,7 @@ | ||
[program:nginx] | ||
command=/usr/sbin/nginx -g "daemon off;" | ||
autostart=true | ||
autjson=true | ||
autorestart=true | ||
stderr_logfile=/var/log/nginx.err.log | ||
stdout_logfile=/var/log/nginx.out.log |
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,6 @@ | ||
[program:php] | ||
command=php-fpm -F | ||
autostart=true | ||
autorestart=true | ||
stderr_logfile=/var/log/php.err.log | ||
stdout_logfile=/var/log/php.out.log |