Deploy your first Laravel app
Your app runs as a container image. GitHub Actions builds the image on every push and tells Elyrawaves Cloud to roll it out. Setting it up takes about fifteen minutes.
Before you start
- A Laravel app in a GitHub repository.
- An invitation to an organization on Elyrawaves Cloud.
- Your app has to listen on port
8080inside the container. The Dockerfile below does that for you.
Add a Dockerfile
Add this Dockerfile to the root of your repository. It installs your dependencies, builds your front-end assets and serves the app with PHP-FPM and Nginx on port 8080.
# syntax=docker/dockerfile:1
FROM serversideup/php:8.4-cli AS vendor
WORKDIR /var/www/html
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-interaction --no-scripts --no-autoloader
FROM node:24-alpine AS assets
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
COPY --from=vendor /var/www/html/vendor ./vendor
RUN npm run build
FROM serversideup/php:8.4-fpm-nginx
ENV AUTORUN_ENABLED=true PHP_OPCACHE_ENABLE=1 LOG_CHANNEL=stderr
WORKDIR /var/www/html
COPY --chown=www-data:www-data --from=vendor /var/www/html/vendor ./vendor
COPY --chown=www-data:www-data . .
COPY --chown=www-data:www-data --from=assets /app/public/build ./public/build
RUN composer dump-autoload --no-dev --optimize
AUTORUN_ENABLED=true runs your migrations and caches your config every time the container starts. Add a .dockerignore with at least .env, .git, node_modules and vendor, so they stay out of the image.
Build with GitHub Actions
Save this as .github/workflows/deploy.yml. On every push to main it builds the image, pushes it to the GitHub container registry and calls your environment's deploy hook.
name: Deploy
on:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v7
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
- name: Deploy
env:
DEPLOY_HOOK_URL: ${{ secrets.DEPLOY_HOOK_URL }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
run: |
curl -fsS -X POST "$DEPLOY_HOOK_URL" \
-d tag=${{ github.sha }} \
-d commit=${{ github.sha }} \
--data-urlencode "message=$(printf '%s' "$COMMIT_MESSAGE" | head -n1 | cut -c1-255)"
- Push once, so the workflow publishes the image. The deploy step fails until the next steps are done.
- On GitHub, open the package under Packages, choose Package settings and set its visibility to Public, so Elyrawaves Cloud can pull it.
- Add the deploy hook URL from the application page as a repository secret named
DEPLOY_HOOK_URL.
Create the application
In the dashboard, open Applications and choose New application. Enter the repository as owner/repository, the branch to deploy, and the region the app should run in. The branch becomes your first environment.
Copy the deploy hook URL from the Deploy hook section on the application page. Anyone with the URL can deploy, so keep it in a secret.
Environment variables
Each environment starts with APP_ENV, APP_DEBUG, a generated APP_KEY and LOG_CHANNEL=stderr. Open Environment variables on the application page to add your own, in the same format as a .env file.
Changes take effect on the next deployment.
Databases and caches
Under Resources, create a database or cache in the same region as your app. When it is available, open Connection details from its menu and copy the values into your environment variables:
DB_CONNECTION=mysql
DB_HOST=203.0.113.10
DB_PORT=3306
DB_DATABASE=shop
DB_USERNAME=app
DB_PASSWORD=your-database-password
REDIS_HOST=203.0.113.20
REDIS_PORT=6379
REDIS_PASSWORD=your-cache-password
For PostgreSQL, use DB_CONNECTION=pgsql and port 5432.
Deploy and roll back
Every push to your branch now deploys on its own. Containers are replaced one at a time, and the deployment shows up on the overview with its status and commit.
To deploy by hand, choose Deploy on the application page and enter an image tag. To roll back, deploy the tag of an earlier commit.
Stuck?
Email us at post@wirelabs.no with your application's name, and we'll help you get it running.