Right way to deploy Go API in a Docker?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • examples

    Minified application examples with different languages and stacks for DockerSlim (by slimtoolkit)

  • You see this a lot because it's easy and convenient. It's not because it's the best/recommended thing to do. You can use multi-stage builds where you copy everything you need from the build stage to the release stage. It works fine as long as you have a simple application and you know exactly what you need from the build stage. It gets tricky with more complex applications. Another option to try is DockerSlim. It allows you to take those less than ideal container images you see a lot and make them as small as possible. Take a look at this Go application example: https://github.com/docker-slim/examples/blob/master/3rdparty/mux-go-api/Dockerfile

  • ko

    Build and deploy Go applications

  • If you want an alternative, lightweight method to create slim Docker images for a Go app, you can check out Ko: https://github.com/google/ko

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • distroless

    🥑 Language focused docker images, minus the operating system.

  • That's why https://github.com/GoogleContainerTools/distroless is the true perfection.

  • rootcerts

    Go package to embed the Mozilla Included CA Certificate List

  • You can also use https://github.com/breml/rootcerts so you don't even need to copy the files.

  • golang-sample-app

    Example application with Golang and Docker

  • Here is a better approach with multi stage builds that does not have the source code https://github.com/codefresh-contrib/golang-sample-app/blob/master/Dockerfile.multistage

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts