Deploy Laravel on Oracle Cloud's free tier
PHP-FPM, queues and scheduled tasks on a VM that never sleeps — the parts shared hosting makes awkward.
At a glance
| Base image | php:8.3-fpm-alpine |
|---|---|
| Port | 9000 |
| Build command | composer install --no-dev --optimize-autoloader && npm ci && npm run build |
| Start command | php-fpm |
| Infrastructure cost | $0 on Oracle Always Free (platform fee for managed DevOps) |
Running Laravel on Ampere ARM
The official PHP images are multi-arch. OPcache plus config/route caching on an Ampere core gives response times most shared hosts cannot match.
Steps
- Cache config, routes and views at build. It removes filesystem work from every request.
- Run the queue worker as its own container. `php artisan queue:work` needs a long-lived process — exactly what a VM gives you.
php artisan queue:work --tries=3 --timeout=90 - Add the scheduler. A cron container running `php artisan schedule:run` every minute replaces platform cron add-ons.
Dockerfile for Laravel on ARM64
FROM php:8.3-fpm-alpine
WORKDIR /var/www
RUN apk add --no-cache nginx supervisor libpng-dev icu-dev \
&& docker-php-ext-install pdo_mysql opcache intl gd
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-scripts --optimize-autoloader
COPY . .
RUN php artisan config:cache && php artisan route:cache && php artisan view:cache
EXPOSE 9000
CMD ["php-fpm"]Need one tailored to your repository? The free Dockerfile generator writes an ARM-ready multi-stage build for you.
Common mistakes
- Storage permissions: storage/ and bootstrap/cache must be writable by the php-fpm user.
- APP_KEY missing: Encrypted cookies and sessions fail immediately without it.
- Cached config with wrong env: Re-run config:cache after changing env vars, or the old values persist.
Related reading
Get the Oracle Always Free deploy checklist
One email with the exact steps, capacity workarounds and tools we use to ship apps for $0 of cloud spend.
One email, no spam. Unsubscribe anytime.
Frequently asked
Do queues and Horizon work?+
Yes — persistent processes are the whole advantage of a VM over serverless PHP.
Which database?+
MySQL or Postgres in a container on the same VM, or Oracle Autonomous Database.
How do I run migrations?+
As a release command before traffic is switched to the new container.
Deploy your project for $0
No credit card. No Oracle sales call. Ship to your own cloud in under 10 minutes.
Start free