Laravel BASIC is a joke that actually runs: an imitation of Laravel written in BASIC, without a single line of PHP, serving real web pages. Our colleagues at programacion.net (in Spanish) covered how it is programmed. Here we look at the other half: how it is deployed, what its container does to stay harmless, and what broke when we tested it.
The project is by David Carrero, it is on GitHub under the MIT licence, and every screenshot in this article comes from our own test run.
Update (5 December): version 1.0.0 is out, with its own homepage and a prebuilt image on GitHub Container Registry for amd64 and arm64. See “How to try it” below.
The architecture: socat, bash and one interpreter per request
There is no nginx and no PHP-FPM. The “web server” is one line of socat:
socat TCP-LISTEN:8000,reuseaddr,fork EXEC:bootstrap/handle.sh
For each connection, socat forks and runs a bash script that reads the request, validates it, writes it to a temporary file and launches bwbasic with the compiled program. Whatever the program prints becomes the HTTP response. It is the old CGI or inetd model: one process per request, nothing shared.
The entry script sets some sensible limits: it kills any run after five seconds with timeout, caps the request size and adds security headers (Content-Security-Policy, X-Frame-Options: DENY, X-Content-Type-Options: nosniff and Referrer-Policy).
What the container gets right
The image is based on debian:stable-slim and installs only bwbasic, socat, bash, coreutils and curl. The docker-compose.yml applies most of what you would expect from a real service:
- Unprivileged user (
basic, uid 1000). - Read-only root filesystem with
read_only: true. - tmpfs for
/tmpand for the logs. - No kernel capabilities (
cap_drop: ALL) plusno-new-privileges. - HEALTHCHECK that requests the home page every 30 seconds.
services:
app:
build: .
ports:
- "8000:8000"
read_only: true
tmpfs:
- /tmp
- /app/storage/logs:uid=1000,gid=1000,mode=0755
cap_drop: [ALL]
security_opt:
- no-new-privileges:trueCode language: PHP (php)

Three bugs that only show up when you test it
The Dockerfile built on the first try and the site answered. A closer look still turned up three problems that are very common in hardened containers. They are fixed in the repository now.
1. The log tmpfs belonged to root
With read_only, the only place to write logs is a tmpfs. Docker mounts it as root with mode 755 by default, so the basic user could not write to it. Because the log function swallowed errors, the container looked healthy while the log file stayed empty. The fix is to set the owner on the mount itself: /app/storage/logs:uid=1000,gid=1000,mode=0755. Worth checking in any read-only container that writes to a tmpfs.
2. The tests could not run inside the image
The program was compiled during docker build, before USER basic, so build/ ended up owned by root. The test command rebuilds before testing and failed with a permissions error. A chown in the same layer fixes it: RUN ./gosubtisan build && chown -R basic:basic build.
3. An unset environment variable was not empty
.dockerignore excludes .env, as it should. Without it, though, bwBASIC’s ENVIRON$("APP_NAME") does not return an empty string but garbage bytes, and the home page showed noise as the app name. Defaults now live in the bash script with ${APP_NAME:-Laravel BASIC}, and a new test guards it. The lesson applies to any image: check how it behaves without .env, because in production and CI it will not have one.

CI that builds the image
Until now, GitHub Actions only ran the tests on the runner itself, so nothing checked the Dockerfile. A second job now builds the image, runs the tests inside it and brings up the read-only compose stack to check that it answers and that the log gets written. Break the container and CI turns red. Since 1.0.0 it also runs ShellCheck on the bash scripts and publishes the image to GitHub Container Registry on every push to main and on every release tag.
How to try it
The quickest way is the prebuilt image, no clone needed. It is built for amd64 and arm64, and the 1.0.0 tag pins the version:
docker run --rm -p 8000:8000 ghcr.io/dcarrero/laravel-basic
# or, pinned:
docker run --rm -p 8000:8000 ghcr.io/dcarrero/laravel-basic:1.0.0Code language: PHP (php)
We pulled it without logging in to the registry and it answers on port 8000. Note that a bare docker run does not apply the read-only filesystem or drop capabilities; for that, use the compose file in the repository:
git clone https://github.com/dcarrero/laravel-basic.git
cd laravel-basic
docker compose up --build -d
docker compose ps # should say (healthy)
curl -I http://localhost:8000/users
docker compose exec app tail storage/logs/laravel-basic.log
docker compose downCode language: PHP (php)

Why not in production?
The container is better locked down than many you will find in production, but what runs inside is still a joke:
- A new process per request and no connection limit in socat: a handful of slow requests is enough to swamp it.
- GET only: no POST, forms, sessions or CSRF protection.
- No TLS: it would need a reverse proxy in front.
- The interpreter, bwBASIC, was never designed to take input from the internet.
As a deployment exercise, though, it is genuinely useful: in a few lines it brings together a non-root user, a read-only filesystem, tmpfs ownership, a healthcheck and a CI job that builds the image.
FAQ
Why does the tmpfs need uid and gid?
Because Docker creates it as root. If the container process is not root, it cannot write there unless the mount sets another owner or looser permissions.
Is socat a real web server?
For tests and demos, yes. For production, no: it neither limits connections nor understands HTTP; it just hands bytes to a script.
What does the healthcheck test?
That the home page answers with a 2xx code within five seconds, every 30 seconds, with three retries.
Sources: programacion.net; Laravel BASIC repository; project homepage; Docker Compose documentation.
