APIs & backends

    Deploy Go on Oracle Cloud's free tier

    A statically linked Go binary in a scratch image — a few megabytes, instant boot, negligible memory.

    At a glance

    Base imagegolang:1.23-alpine
    Port8080
    Build commandgo build -o server ./cmd/server
    Start command./server
    Infrastructure cost$0 on Oracle Always Free (platform fee for managed DevOps)

    Running Go on Ampere ARM

    Go cross-compiles to arm64 natively and CGO_ENABLED=0 gives a fully static binary — the resulting image is often under 15 MB, the fastest thing you can deploy on an Ampere instance.

    Steps

    1. Build for arm64. Set GOARCH=arm64 if you build anywhere other than the Oracle VM itself.
    2. Use a distroless or scratch runtime. There is no shell to exploit and nothing to patch.
    3. Expose /healthz. Cheap and instant, which makes health-check gated deploys effectively free.

    Dockerfile for Go on ARM64

    FROM golang:1.23-alpine AS build
    WORKDIR /src
    COPY go.mod go.sum ./
    RUN go mod download
    COPY . .
    RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o /out/server ./cmd/server
    
    FROM gcr.io/distroless/static-debian12
    COPY --from=build /out/server /server
    EXPOSE 8080
    USER nonroot:nonroot
    ENTRYPOINT ["/server"]

    Need one tailored to your repository? The free Dockerfile generator writes an ARM-ready multi-stage build for you.

    Common mistakes

    • CGO breaks static builds: Any C dependency (some SQLite drivers) requires a glibc runtime image instead of scratch.
    • Missing CA certificates: Scratch images cannot make outbound HTTPS calls without copying ca-certificates.crt in.
    • Timezone data: Add tzdata if your app formats times in local zones.

    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

    How much RAM does a Go service need?+

    Typically tens of megabytes, so one Ampere instance can host many services.

    Can I run gRPC?+

    Yes — Caddy can proxy gRPC over HTTP/2 with automatic TLS.

    Do I need Docker at all?+

    Cheaploy deploys containers, and a container keeps rollbacks and health checks consistent across stacks.

    Deploy your project for $0

    No credit card. No Oracle sales call. Ship to your own cloud in under 10 minutes.

    Start free