Urgent.News

What's breaking now, across thousands of outlets.

Tech

Deploying Go Applications: The Smallest Docker Images You’ll Ever Ship

Go compiles to a single static binary, perfect for containers. Build 10 MB images and deploy them to your VPS with zero-downtime rollouts. Go was made for this Go compiles to a single statically linked binary with no runtime, no interpreter and no system dependencies. That makes it the best-case scenario for containerization: the final image is your binary plus a few kilobytes of metadata, it…

Go compiles to a single static binary, making it ideal for container deployment. The resulting image is small—under 15 MB—thanks to the -ldflags= -s -w flag, which strips debug symbols and reduces the binary size. Build processes are efficient, with dependency downloads cached across code changes. Dockerfiles can be optimized to use golang:1.24-alpine AS build, copying go.mod/go.sum before source files, and then building the binary with CGO_ENABLED=0.

Distroless images provide additional benefits, including CA certificates, tzdata, and a nonroot user, all within a 2 MB footprint. This eliminates common "works locally, fails in prod" issues. Graceful shutdown and health checks are easily implemented in the binary itself using Go.

Zero-downtime deployments become straightforward, requiring only a /healthz handler and container health check. The binary cooperates by listening on port 8080 and gracefully shutting down when a SIGTERM or interrupt signal is received. This approach allows deployments to overlap old and new containers, ensuring no dropped requests.

Scaling is simple, as a 10 MB image can be hosted on a 2 GB VPS, hosting a small fleet of Go services each idling at 10 to 30 MB of RSS. Cross-compilation to ARM servers is also straightforward, by setting GOARCH=arm64. This results in a consistent Dockerfile across different hardware architectures.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A Shapefile Is Four Files, and the Important One Is Optional

A user clicks "upload" and picks a file. In most systems that sentence is the whole story. In a geospatial system, the thing they picked is one of four files that only mean something together, the one…

  • A shapefile comprises four files: .shp, .shx, .dbf, and .prj
  • The .shp file holds geometry, .shx is an index, and .dbf contains attributes
  • The .prj file defining coordinate system is optional but often missing

Stop Trusting Text-Only Agent Leaderboards: Lessons from Cua-Bench and Factorio

Stop Trusting Text-Only Agent Leaderboards: Lessons from Cua-Bench and Factorio Overfitting to leaderboard benchmarks has created a field of agents tuned for text puzzles but fragile the moment real…

  • Text-only agent leaderboards can be misleading
  • Cua-Bench and Factorio LE expose this fragility
  • Agents fail at stateful context, error recovery

More from Wednesday 26 August →