Skip to content

Build Configuration

SKE builds a container image for each deployment. The Laravel runtime generates a default Dockerfile, but you can customize the build with your own Dockerfile and build hooks.

When you deploy without a custom Dockerfile, SKE generates one based on your runtime. For Laravel, the generated Dockerfile:

  • Uses a PHP base image matching your configured version
  • Installs required PHP extensions
  • Runs composer install --no-dev --optimize-autoloader
  • Copies your application code
  • Includes the SKE adapter binary for request handling

The generated Dockerfile is placed in ske/Dockerfile relative to your project root.

To use a custom Dockerfile, set the dockerfile key in ske.yml:

name: my-app
environments:
production:
dockerfile: docker/production.Dockerfile

Or set it at the project level to apply to all environments:

name: my-app
dockerfile: docker/Dockerfile
environments:
production: {}
staging: {}

Per-environment dockerfile overrides the project-level setting.

  1. Per-environment dockerfile in ske.yml
  2. Project-level dockerfile in ske.yml
  3. Default: ske/Dockerfile (auto-generated by the runtime)

Build hooks let you run custom commands during the container build. Define them in ske.yml:

name: my-app
environments:
production:
build_hooks:
- npm ci
- npm run build
- php artisan route:cache
- php artisan config:cache
- php artisan view:cache
- php artisan event:cache

Build hooks run inside the container during the image build, after composer install and before the final image layer. They’re useful for:

  • Compiling frontend assets (npm run build, vite build)
  • Caching Laravel configuration files
  • Running any pre-deployment preparation

Deploy hooks run after the container is deployed and active:

name: my-app
environments:
production:
deploy_hooks:
- php artisan migrate --force

Deploy hooks execute as remote commands against the deployed environment. Use them for database migrations or other post-deploy tasks.

The PHP version and extensions are determined by the Laravel runtime based on your composer.json requirements. SKE reads your require.php constraint and selects the appropriate base image.

To pin a specific PHP version, set it in composer.json:

{
"require": {
"php": "^8.3"
}
}

The build context includes your entire project directory, excluding:

  • .git/
  • .env
  • vendor/ (reinstalled during build)
  • node_modules/ (reinstalled if build hooks use npm)
  • tests/
  • storage/ (ephemeral on serverless — use cloud storage instead)

During deployment, SKE scans your public/ directory and uploads static assets (CSS, JS, images, fonts) to cloud storage for CDN delivery. This happens automatically — no configuration needed.

The artifact size limit is 500 MB.