Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: workflow to upload theme directory artifact #39

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ node_modules
package-lock.json
package.json
php.ini
plugins
src
tasks
test
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/deploy.docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Docker Image

on:
push:
branches: [main]
workflow_dispatch:

jobs:
deploy:
if: ${{ vars.DEPLOY_WITH_DOCKER }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note in #94 that this is a variable that needs to be set in GitHub

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install npm dependencies
run: npm ci

- name: Install custom plugin npm dependencies
run: npm run plugins:install

- name: Install PHP dependencies with Composer
uses: php-actions/composer@v6
with:
php_version: '8.1'
version: 2.x

- name: Run tests
run: npm test

- name: Build theme
run: npm run build:prod

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GH_TOKEN}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note in #94 that this is a secret that needs to be set in GitHub


- name: 'Build Inventory Image'
run: |
docker build . --tag ghcr.io/sparkbox/sparkpress:latest
docker push ghcr.io/sparkbox/sparkpress:latest
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM php:8.1-apache-buster
FROM php:8.1-apache-buster as dev

LABEL org.opencontainers.image.source=https://github.com/sparkbox/sparkpress-wordpress-starter

# When changings, also change in .circleci/config.yml
ENV WP_VERSION=6.3.1
Expand Down Expand Up @@ -36,3 +38,11 @@ RUN find /var/www/ -type f -exec chmod 644 {} \;
# make the linters executable so we can run them from containers
RUN chmod +x vendor/bin/phpcs
RUN chmod +x vendor/bin/twigcs

FROM dev as prod

COPY theme /var/www/html/wp-content/themes/sparkpress-theme
COPY plugins /var/www/html/wp-content/plugins
COPY wp-configs/wp-config.php /var/www/html/wp-config.php
COPY wp-configs/php.ini /var/www/html/php.ini
COPY wp-configs/.htaccess /var/www/html/.htaccess
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ version: '3.7'

services:
web:
build: .
build:
context: .
target: dev
container_name: sparkpress
ports:
- '8000:80'
Expand Down
Loading