-
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
9 changed files
with
223 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
assignees: | ||
- "xZero707" | ||
|
||
# Maintain Docker image dependencies | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
assignees: | ||
- "xZero707" |
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,38 @@ | ||
name: Build docker WordPress UNIT base image | ||
|
||
on: | ||
push: | ||
branches: master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: checkout code | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 16 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Build and push | ||
uses: docker/[email protected] | ||
with: | ||
files: build/docker-bake.hcl | ||
push: true | ||
set: | | ||
*.cache-from=type=gha,scope=wordpress-base | ||
*.cache-to=type=gha,scope=wordpress-base,mode=max |
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 @@ | ||
.idea/ |
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,91 @@ | ||
ARG WP_IMG_BASE_VERSION=6.1.1 | ||
ARG PHP_VERSION=8.1 | ||
ARG UNIT_VERSION=1.29.0 | ||
|
||
|
||
|
||
################################################ | ||
# Tag official WordPress image resources # | ||
################################################ | ||
FROM wordpress:${WP_IMG_BASE_VERSION}-php${PHP_VERSION}-fpm-alpine AS wordpress | ||
|
||
|
||
|
||
################################################ | ||
# Build rootfs # | ||
################################################ | ||
FROM scratch AS rootfs | ||
|
||
# Install attr utility | ||
COPY --from=nlss/attr ["/usr/local/bin/attr", "/usr/local/bin/"] | ||
|
||
# Add crond service | ||
COPY --from=nlss/base-alpine:3.17 ["/etc/services.d/cron/", "/etc/services.d/cron/"] | ||
|
||
# WordPress specific php configuration | ||
COPY --from=wordpress ["/usr/local/etc/php/conf.d/opcache-recommended.ini", "/usr/local/etc/php/conf.d/error-logging.ini", "/usr/local/etc/php/conf.d/"] | ||
|
||
# Overlay | ||
COPY ["./rootfs/", "/"] | ||
|
||
|
||
|
||
################################################ | ||
# Final stage # | ||
################################################ | ||
ARG PHP_VERSION | ||
ARG UNIT_VERSION | ||
FROM --platform=${TARGETPLATFORM} nlss/unit-php:${UNIT_VERSION}-PHP${PHP_VERSION} | ||
|
||
RUN set -eux \ | ||
&& apk add --update --no-cache bash less mysql-client tzdata imagemagick ghostscript \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
${PHPIZE_DEPS:?} \ | ||
freetype-dev \ | ||
icu-dev \ | ||
imagemagick-dev \ | ||
libjpeg-turbo-dev \ | ||
libpng-dev \ | ||
libwebp-dev \ | ||
libzip-dev \ | ||
&& docker-php-ext-configure gd \ | ||
--with-freetype \ | ||
--with-jpeg \ | ||
--with-webp \ | ||
&& docker-php-ext-install -j "$(nproc)" \ | ||
bcmath \ | ||
exif \ | ||
gd \ | ||
intl \ | ||
mysqli \ | ||
zip \ | ||
&& pecl install imagick-3.6.0 \ | ||
&& docker-php-ext-enable imagick \ | ||
&& rm -r /tmp/pear \ | ||
&& extDir="$(php -i | grep "^extension_dir" | awk -F'=>' '{print $2}' | xargs)" \ | ||
&& runDeps="$( \ | ||
scanelf --needed --nobanner --format '%n#p' --recursive "${extDir}" \ | ||
| tr ',' '\n' \ | ||
| sort -u \ | ||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ | ||
)" \ | ||
&& apk add --no-network --virtual .wordpress-phpexts-rundeps ${runDeps} \ | ||
&& apk del --no-network .build-deps \ | ||
&& php --version || exit 1 \ | ||
&& mkdir -p /var/www/html/wp-content/{languages,themes,plugins,uploads} \ | ||
&& chown -R www-data:www-data /var/www/html/wp-content | ||
|
||
COPY --from=rootfs ["/", "/"] | ||
|
||
RUN echo "*/5 * * * * /usr/local/bin/wp cron event run --due-now" >> /etc/crontabs/www-data | ||
|
||
ENV S6_KEEP_ENV=1 | ||
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 | ||
ENV CRON_ENABLED=true | ||
|
||
ARG WP_IMG_BASE_VERSION | ||
ENV WP_IMG_BASE_VERSION=${WP_IMG_BASE_VERSION} | ||
|
||
LABEL maintainer="Aleksandar Puharic <[email protected]>" | ||
ENTRYPOINT ["/init"] | ||
EXPOSE 80/TCP |
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,24 @@ | ||
group "default" { | ||
targets = ["1_0_0"] | ||
} | ||
|
||
target "build-dockerfile" { | ||
dockerfile = "Dockerfile" | ||
} | ||
|
||
target "build-platforms" { | ||
platforms = ["linux/amd64", "linux/armhf", "linux/aarch64"] | ||
} | ||
|
||
target "build-common" { | ||
pull = true | ||
} | ||
|
||
target "1_0_0" { | ||
inherits = ["build-dockerfile", "build-platforms", "build-common"] | ||
tags = ["docker.io/nlss/wordpress-unit-base:latest", "docker.io/nlss/wordpress-unit-base:1.0.0"] | ||
args = { | ||
WP_IMG_BASE_VERSION = "6.1.1" | ||
PHP_VERSION = "8.1" | ||
} | ||
} |
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 @@ | ||
#!/usr/bin/with-contenv sh | ||
set -e | ||
|
||
/usr/local/bin/attr /var/www true www-data:www-data 0770 2771 |
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,44 @@ | ||
{ | ||
"listeners": { | ||
"*:80": { | ||
"pass": "routes" | ||
} | ||
|
||
}, | ||
"routes": [ | ||
{ | ||
"match": { | ||
"uri": [ | ||
"*.php", | ||
"*.php/*", | ||
"/wp-admin/" | ||
] | ||
}, | ||
"action": { | ||
"pass": "applications/wordpress/direct" | ||
} | ||
}, | ||
{ | ||
"action": { | ||
"share": "/var/www/html$uri", | ||
"fallback": { | ||
"pass": "applications/wordpress/index" | ||
} | ||
} | ||
} | ||
], | ||
"applications": { | ||
"wordpress": { | ||
"type": "php", | ||
"targets": { | ||
"direct": { | ||
"root": "/var/www/html/" | ||
}, | ||
"index": { | ||
"root": "/var/www/html/", | ||
"script": "index.php" | ||
} | ||
} | ||
} | ||
} | ||
} |
Empty file.
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,3 @@ | ||
<?php | ||
|
||
echo 'Hello World!'; |