I recently started this blog in order to share my notes on self-hosting Solidtime, a Laravel-based time keeping application, with @michabbb.bsky.social. To accomplish that, I decided to try out HydePHP, a console application for building static HTML websites with a Laravel backend.
Shout-out to maintainer Caen De Silva for talking through the challenges I had trying to build HydePHP in Docker, and redirecting me back to HydePHP's first-party build tools. See issue#662 for details.
The HydePHP Action documentation is excellent, but my Gitea Action Runner environment was missing Composer. I used shivammathur/setup-php@v2 to add it.
Also, we will set up SSH access in order to scp
the build artifact contents to your Docker host at a bind volume mount point.
- Setup SSH access to your Docker host.
-
Generate a SSH key pair using
ssh-keygen
.❯ ssh-keygen Generating public/private ed25519 key pair
-
Add the public key to
authorized_keys
for your Docker host machine user.echo "<your-public-key>" >> ~/.ssh/authorized_keys`
-
Add the private key to Gitea:
Settings > Actions > Secrets
-
- Add a Workflow to your repository.
- Create
.github/workflows/deploy.yaml
- Create
deploy.yaml
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: php-cs-fixer, phpunit
- uses: hydephp/action@master
with:
upload-artifact: false
- name: Configure and Test SSH
run: |
echo "$SSH_PRIVATE_KEY" > id_rsa
chmod 600 id_rsa
mkdir -p ~/.ssh
ssh-keyscan -H <docker-hostname-or-up> >> ~/.ssh/known_hosts
env:
SSH_PRIVATE_KEY: ${{ secrets.DOCKER01_SSH_PK }}
- name: Deploy via SCP
run: scp -r -i id_rsa ./_site/* <user>@<docker-hostname-or-ip>:/<hydephp-bind-volume>/_site