Skip to content

Commit

Permalink
Add wp-cli config and entrypoint (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfirdaus authored Jan 9, 2024
1 parent defdb06 commit ff280c5
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 58 deletions.
35 changes: 13 additions & 22 deletions .github/workflows/wp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
version: ["7.4", "8.0", "8.1", "8.2"]

env:
IMAGE_PATH: ./wp/php${{ matrix.version }}
IMAGE_CONTEXT: ./wp/php${{ matrix.version }}
IMAGE_FILE: ./wp/php${{ matrix.version }}/Dockerfile
IMAGE_REGISTRY: ghcr.io
IMAGE_TAG: ghcr.io/${{ github.repository_owner }}/wp:php${{ matrix.version }}-fpm
Expand All @@ -49,13 +49,22 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and export
- name: Extract metadata (tags, labels) for Docker
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_TAG }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
load: true
provenance: false
push: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
context: ${{ env.IMAGE_CONTEXT }}
file: ${{ env.IMAGE_FILE }}
tags: ${{ env.IMAGE_TAG }}
labels: ${{ steps.metadata.outputs.labels }}
platforms: linux/amd64,linux/arm64

- name: Test run image
run: |
Expand All @@ -67,21 +76,3 @@ jobs:
else
exit 1;
fi
- name: Extract metadata (tags, labels) for Docker
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_TAG }}

- name: Build and push
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: ${{ env.IMAGE_PATH }}
push: true
provenance: false
file: ${{ env.IMAGE_FILE }}
tags: ${{ env.IMAGE_TAG }}
labels: ${{ steps.metadata.outputs.labels }}
platforms: linux/amd64,linux/arm64
14 changes: 6 additions & 8 deletions wp/php7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ RUN docker-php-serversideup-dep-install-debian 'ghostscript default-mysql-client
RUN install-php-extensions 'mysqli'; \
php -m;

COPY --chmod=755 entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
mkdir -p /var/www/html; \
chown -R www-data:www-data /var/www/html

COPY --chmod=755 ./entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
chmod +x /usr/local/bin/wp; \
mkdir -p /var/www/.wp-cli; \
chown -R www-data:www-data /var/www/.wp-cli;

COPY --chmod=644 --chown=www-data:www-data ./wp-cli.yml /var/www/.wp-cli/config.yml

RUN wp cli info;
echo "path: /var/www/html" > /var/www/.wp-cli/config.yml; \
chown -R www-data:www-data /var/www/.wp-cli; \
wp cli info;

RUN set -eux; \
apt-get update; \
Expand Down
1 change: 0 additions & 1 deletion wp/php7.4/wp-cli.yml

This file was deleted.

14 changes: 6 additions & 8 deletions wp/php8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ RUN docker-php-serversideup-dep-install-debian 'ghostscript default-mysql-client
RUN install-php-extensions 'mysqli'; \
php -m;

COPY --chmod=755 entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
mkdir -p /var/www/html; \
chown -R www-data:www-data /var/www/html

COPY --chmod=755 ./entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
chmod +x /usr/local/bin/wp; \
mkdir -p /var/www/.wp-cli; \
chown -R www-data:www-data /var/www/.wp-cli;

COPY --chmod=644 --chown=www-data:www-data ./wp-cli.yml /var/www/.wp-cli/config.yml

RUN wp cli info;
echo "path: /var/www/html" > /var/www/.wp-cli/config.yml; \
chown -R www-data:www-data /var/www/.wp-cli; \
wp cli info;

RUN set -eux; \
apt-get update; \
Expand Down
1 change: 0 additions & 1 deletion wp/php8.0/wp-cli.yml

This file was deleted.

14 changes: 6 additions & 8 deletions wp/php8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ RUN docker-php-serversideup-dep-install-debian 'ghostscript default-mysql-client
RUN install-php-extensions 'mysqli'; \
php -m;

COPY --chmod=755 entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
mkdir -p /var/www/html; \
chown -R www-data:www-data /var/www/html

COPY --chmod=755 ./entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
chmod +x /usr/local/bin/wp; \
mkdir -p /var/www/.wp-cli; \
chown -R www-data:www-data /var/www/.wp-cli;

COPY --chmod=644 --chown=www-data:www-data ./wp-cli.yml /var/www/.wp-cli/config.yml

RUN wp cli info;
echo "path: /var/www/html" > /var/www/.wp-cli/config.yml; \
chown -R www-data:www-data /var/www/.wp-cli; \
wp cli info;

RUN set -eux; \
apt-get update; \
Expand Down
1 change: 0 additions & 1 deletion wp/php8.1/wp-cli.yml

This file was deleted.

14 changes: 6 additions & 8 deletions wp/php8.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ RUN docker-php-serversideup-dep-install-debian 'ghostscript default-mysql-client
RUN install-php-extensions 'mysqli'; \
php -m;

COPY --chmod=755 entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
mkdir -p /var/www/html; \
chown -R www-data:www-data /var/www/html

COPY --chmod=755 ./entrypoint.sh /etc/entrypoint.d/70-wp-core-download.sh
COPY --from=wp-cli /usr/local/bin/wp /usr/local/bin/

RUN set -eux; \
chmod +x /usr/local/bin/wp; \
mkdir -p /var/www/.wp-cli; \
chown -R www-data:www-data /var/www/.wp-cli;

COPY --chmod=644 --chown=www-data:www-data ./wp-cli.yml /var/www/.wp-cli/config.yml

RUN wp cli info;
echo "path: /var/www/html" > /var/www/.wp-cli/config.yml; \
chown -R www-data:www-data /var/www/.wp-cli; \
wp cli info;

RUN set -eux; \
apt-get update; \
Expand Down
1 change: 0 additions & 1 deletion wp/php8.2/wp-cli.yml

This file was deleted.

0 comments on commit ff280c5

Please sign in to comment.