Backend

How to deploy a Go app on Rock8Cloud

Deploy your Go service to Rock8Cloud - a static binary in a tiny container. Connect your GitHub repo, hit deploy, live in about two minutes, provisioned PostgreSQL one click away.

Updated June 5, 2026 · Port 8080
How to deploy Go on Rock8Cloud

A Go service compiles to a single static binary and ships in a tiny container. Connect your GitHub repo, hit deploy, and you get a live URL in about two minutes - with a provisioned PostgreSQL one click away.

Deploy your app#

One step: select GitHub repository deployment, connect your repo, and hit Deploy. Rock8Cloud builds the container image and serves your service at a live URL, with build and runtime logs in your browser.

No Dockerfile in the repo? Copy the example below.

Pro tip: Set EXPOSE in your Dockerfile and Rock8Cloud infers the container port automatically - nothing else to configure.

Example Dockerfile
# Build
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /app ./...

# Run
FROM alpine:3.20
COPY --from=build /app /app
EXPOSE 8080
CMD ["/app"]

EXPOSE 8080 is what Rock8Cloud reads to route traffic to your container - no manual port setting needed.

Don’t have an app?#

One-click start from our open-source template - a Go REST API with Gin, PostgreSQL via pgx, embedded migrations, and Swagger UI. It’s cloned to your GitHub, wired to a provisioned Postgres, and put live on our domain. Or just browse it on GitHub and borrow what you need.

Pro tip: You can assign your own domain to the app later.

Go + Postgres example
rock8-cloud/template-go

Add a database

Rock8Cloud provisions databases inside your project - no external vendor, no separate bill. Secure credentials and networking are handled for you. Two engines are available:

  • PostgreSQL - relational database (versions 14–17), 1–100 GB storage, optional high-availability replica.
  • Dragonfly - a Redis-compatible in-memory store for caching, sessions, and queues. Drop-in for any Redis client.

Create it, then set environment variables

  1. In your project, choose Add Service → Database, then pick the engine, version, and storage. Rock8Cloud provisions it with secure, auto-generated credentials.
  2. Open your Go service and switch to the Env vars tab - home to all of your app's environment variables. Set any custom keys you need. Linked database values live right alongside them.
  3. Add the database's connection variables under the names your framework expects (for example DATABASE_URL). Save, and your Go service automatically redeploys with the connection wired in.
Link environment variables in one click

The connection values are accessible to your app as plain environment variables - read them the standard way for your stack. Databases are network-isolated to your project: reachable only by your own services, never exposed publicly. Available databases & storage: PostgreSQL · Dragonfly (Redis) · S3 object storage.

What you get#

  • A live URL on our domain - share it the moment the first build lands.
  • Deploy on push - every push to your configured default branch rebuilds and ships automatically.
  • A preview URL per pull request - review real builds, not screenshots.
  • Instant rollback - one click back to any known-good build.

Add a frontend?#

Serving a SPA in front of your API? Deploy it as its own service - see the Vue guide - and point it at your API’s URL with a build-time variable. Need caching or file storage too? Dragonfly and S3 are one click each.

Frequently asked questions

Do I need a Dockerfile to deploy Go?
Yes - copy the example from this guide. If it sets EXPOSE, Rock8Cloud infers the container port automatically, so there is nothing else to configure.
Is there a faster way to try it?
Yes - the open-source Go template (Gin, PostgreSQL via pgx, embedded migrations, Swagger UI) clones to your GitHub and goes live wired to a provisioned Postgres in one click. You can assign your own domain later.
Which Go version does the example use?
The example Dockerfile pins golang:1.23 - bump the build image to match the toolchain in your go.mod.
How do I connect a database to my Go service?
Provision a PostgreSQL in your project and link it to the service. The connection string becomes accessible as an environment variable on the next deploy.

More guides

Ship today

Ship your Go app.Today.

Connect the repo, hit deploy, share the URL. Everything after that is just git push.

60 days free. No credit card required to start.