# Laravel for Go, serverless: one binary and no shell

What changes when a Laravel app is one static Go binary in a serverless container. The build, the distroless image, patches, signed jobs and the edge.

## In short

- Brewless deploys Laravel for Go in beta, with `framework: laravel-go` in `brewless.yml`, the module `github.com/brewless/laravel-go` and the same `brewless init` and `brewless deploy` as Laravel for PHP.
- The build compiles the package at the project root with `CGO_ENABLED=0` into one static binary, and only that binary, `public/` and `storage/` go into the image, so your source is not in it.
- The image is a distroless base of 1.6 MB compressed with certificates, time zones and a user, and no C library, no shell and no package manager.
- Brewless puts a new base image under a live Go release without compiling, but a fix in a Go module or in Go's standard library is inside the binary and needs a deploy.
- Jobs on Scaleway Queues are signed by the module and delivered to the worker as they arrive, and a signature that does not hold drops the message with a warning in the log.

A Laravel app on PHP ships as code plus a runtime: a web server, PHP, its extensions, and your Composer packages on top. [Laravel for Go](https://go.laravel.com) ships as one file. The framework, the web server and your code are compiled into a single static binary that speaks HTTP itself.

That changes what a deploy pipeline has to do, what ends up in the container, and who patches what. This post walks through those differences as [Brewless](/) handles them, on a serverless container in your own Scaleway project, behind bunny.net. The [Laravel for Go page](/go) has the measurements; this post is about the mechanics.

> [!NOTE]
> Laravel for Go is at version 0.x and its APIs may change before 1.0. Our support is a beta with it, and the module `github.com/brewless/laravel-go` follows the framework release by release.

## Can you run Laravel for Go serverless today?

Yes. Brewless builds a Laravel for Go application, runs its migrations and puts it live as a serverless container, with the same `brewless init` and `brewless deploy` as Laravel for PHP. It is a beta, and it is part of every plan at the same price.

The setup is one module and one line. The module is the Go counterpart of the Composer package `brewless/laravel` and the Rust crate `brewless-laravel`: it answers on the paths Brewless uses for release commands, the schedule and the queue.

```bash
go get github.com/brewless/laravel-go
```

In `main.go`, the application starts through the module instead of the framework directly:

```go main.go
brewless.Run(bootstrap.Options())
```

`brewless init` recognises the project from `go.laravel.com` in `go.mod` and writes the manifest. There is no `php` line:

```yaml brewless.yml
organisation: acme
application: shop
framework: laravel-go

release:
  - 'migrate --force'

environments:
  production:
    edge:
      cache: 1h
```

The machine that deploys still needs PHP 8.3 or newer, because the command line client is a PHP program. Your application and its container do not. The [documentation](https://docs.brewless.eu/getting-started/laravel-for-go) has every step.

## What does the build do with a Go project?

The build runs as a Serverless Job in your own Scaleway project, with 2 vCPU and 4 GB of memory, on a builder image with Go 1.27 and Node. In order:

1. With a `package-lock.json`: `npm ci` and `npm run build`, so what Vite writes is in `public/` before the binary exists.
2. `go mod verify`: every module the build takes, downloaded or cached, must match the hash in your committed `go.sum`.
3. `go build` of the package at the project root, which must be `package main`, with `CGO_ENABLED=0`, `-trimpath` and `-mod=readonly`.
4. The `build` commands of your `brewless.yml`, if any.

Two of those flags matter more than they look. `-mod=readonly` means the build never changes `go.mod` or `go.sum` on its own: what you committed is what gets built. `CGO_ENABLED=0` makes the binary static, which is what lets it run on an image without a C library.

There is one toolchain for now. A `toolchain` line in `go.mod` does not make the build fetch another Go version, because the build runs with `GOTOOLCHAIN=local`.

### Why the second build is shorter

Compiling takes longer than a Composer install. On our trial application on 2 December 2026, the first build took 415 seconds and a build with the cache 217 seconds.

The difference is Go's downloaded modules and its build cache, kept between builds as one zstd-compressed object in a bucket of your own project. The build job gets a link to fetch that object and a link to put it back, never a key to your storage. It is only put back when `go.sum` or the Go version changed. A cache that is missing or unreadable never fails a build: the build starts from nothing. And an object larger than 4 GiB, or one with paths that lead outside its two folders, is not unpacked at all.

## What is in the container?

Your binary, as `.brewless/app`, next to `public/` and `storage/`. Nothing else of your project goes along, so your source is not in the image.

Under it is `ghcr.io/brewless/brewless-base:go`, a distroless image that holds certificates, time zones and a user. It has no C library, no shell and no package manager, and the container runs as `www-data`.

| Per container | Laravel for PHP | Laravel for Go |
| --- | --- | --- |
| Base image, compressed | 239 MB | 1.6 MB |
| What the base image holds | FrankenPHP with PHP and its extensions | Certificates, time zones and a user |
| What a build does | Installs your Composer packages | Compiles your application |
| Database settings | `DB_HOST` and the other parts | One `DATABASE_URL`, over TLS |

No shell means there is nothing to log in to and nothing for an attacker to run a script with. It also means there is no `php artisan tinker` equivalent: `brewless tinker` has nothing to run for a Go application, and `brewless command` runs your own binary's console commands instead.

```bash
brewless command staging "route:list"
```

Migrations are compiled into the binary and run as the release command `migrate --force` before a release goes live. The framework has no command to roll a migration back, so a change you want to undo is a new migration. [`brewless rollback`](https://docs.brewless.eu/deployments/rollbacks) puts the previous image back and leaves the database alone.

## Who patches what in a Go container?

This is the part that differs most from PHP, so it is worth being precise.

Brewless watches the Go base image every hour. When a new one is published, because the distroless image under it or a Go release moved, Brewless takes the layer with your binary as it was built and puts it on the new base image. **Nothing is compiled.** The release goes live like a rollback, `production` goes last, and the owners and administrators get a mail. This works the way it does for PHP, described in [security updates without a rebuild](/blog/security-updates-without-a-rebuild), and `runtime_updates: false` switches it off.

What that does not cover is everything inside the binary:

| A vulnerability in | Fixed by |
| --- | --- |
| The distroless base image | Brewless, under the live release, without compiling |
| A Go module your application compiled in | You: update the module and deploy |
| Go's standard library | A new Go release in the builder image, and your next deploy |

With PHP, a patched PHP release is part of the runtime under your code, so Brewless can put it under a live release. With Go, the standard library is compiled into your binary. A Go patch release reaches your application with your next deploy, not before.

> [!TIP]
> Treat `go.sum` like `composer.lock`. Keep your modules current, and deploy after a Go security release once the builder image has it.

## How do queues work without a worker that stays running?

Nothing stays running on a serverless container, so something has to call the worker. With `queue: sqs`, your application changes nothing: the connection is still called `sqs`, and the module puts a driver of its own in its place.

1. The module signs every job your application dispatches, with a key derived from `APP_KEY` and the environment. The signature is the same as the Rust crate's.
2. Scaleway Queues delivers each message to the worker container as it arrives.
3. The module checks the signature and runs that one job with the framework's own worker, so tries, backoff and failed jobs behave as they do for `queue:work`.

A message that is unsigned, was changed on the way, was signed in another environment, was signed more than an hour ago or names another application's queue is dropped, with a warning in the log. A second delivery of a job that already ran is dropped too, because each delivery is marked in your application's cache first.

Scaleway Queues takes a delay of at most 15 minutes. A job with a longer delay goes back on the queue for what is left when it arrives, signed again. The schedule works the same way PHP's does: a Scaleway cron calls the worker only at the moments your schedule has work. The background is in [Laravel queues without a worker](/blog/laravel-queues-without-a-worker).

## What does the edge keep?

The module adds `Cache-Control: public, max-age=0, s-maxage=<edge.cache>` to a GET or HEAD answer that sets no cookie, has no `Cache-Control` of its own and varies on nothing but `Accept-Encoding`. bunny.net then answers the next visitor without waking your container, and every release empties the edge.

A request that says who is asking is never kept: one with a cookie, `Authorization`, `X-Requested-With`, `X-Inertia`, or a header whose name holds a word such as `auth`, `token`, `session` or `tenant`.

The practical rule: a page that starts a session sets a cookie, and a page that sets a cookie is never kept. Keep the session off the routes of public pages you want the edge to answer.

## What is not there yet?

Laravel for Go is young, and a few things `brewless/laravel` does inside a PHP application are not in the module yet:

- Mail through Lettermint. Mail goes through Scaleway Transactional Email with the module's `smtp` mailer.
- Databases per tenant, the client for Malware Protection, the client for database capacity and edge publishing.
- An OpenAPI document for API Guardian.
- Signed jobs on a FIFO queue or on the database queue.
- More than one binary or toolchain: a project builds the one package at its root, on Go 1.27.

If your team writes Laravel in Go, the deploy is the same two commands, in your own Scaleway and bunny.net accounts. The [quickstart](https://docs.brewless.eu/getting-started/quickstart) gets the accounts ready, and the [Laravel for Go documentation](https://docs.brewless.eu/getting-started/laravel-for-go) does the rest.

## Frequently asked questions

### Can I deploy Laravel for Go with Brewless?

Yes, in beta. Add the module `github.com/brewless/laravel-go`, start the application with `brewless.Run` in `main.go`, and run `brewless init` and `brewless deploy`. You need version 1.11.0 or later of the Brewless command line client.

### Is my Go source code in the container image?

No. The build compiles your application into one static binary, and the image holds that binary as `.brewless/app` next to `public/` and `storage/`. Nothing else of the project goes along.

### Does Brewless patch a vulnerability in a Go module I depend on?

Not by itself. Brewless replaces the base image under a live release without compiling, but a module or Go's standard library is compiled into your binary. Update the module, or wait for the builder image with the new Go release, and deploy.

### Can I run tinker on a Laravel for Go application?

No. There is no tinker for Go, so `brewless tinker` has nothing to run. `brewless command` runs your application's own console commands, as commands of its binary.

### How long does a Laravel for Go build take?

On our trial application on 2 December 2026, the first build took 415 seconds and a build with the cache 217 seconds. Your own time depends on the modules your application compiles.

Source: https://brewless.eu/blog/laravel-for-go-one-binary-no-shell
