CtrlB
  • CtrlB Flow
    • 🖐️Introducing CtrlB Flow
    • 🏁Getting started
    • Getting data in CtrlB Flow
    • Explore your data
    • Control your data
  • CtrlB Live Debug
    • 🖐️Introducing CtrlB Live Debug
      • What can you do with CtrlB?
      • How CtrlB works?
    • 🏁Getting started in 2 minutes
    • Plugins
      • Visual Studio Code
      • PyCharm, IntelliJ & WebStorm
    • Agents
      • Python
        • Installation
        • Configuration
        • System Requirements
        • Data Redaction
        • Troubleshoot / Release Notes
          • Version 1.0
      • NodeJs
        • Installation
        • Configuration
        • System Requirements
        • Data Redaction
        • Troubleshoot / Release Notes
          • Version 1.0
      • Java
        • Installation
        • Run with IntelliJ
        • Configuration
        • System Requirements
        • Data Redaction
        • Troubleshoot / Release Notes
      • Go
        • Installation
        • Run with Goland
        • Run with Docker
        • Configuration
        • System Requirements
        • Data Redaction
    • 🎛️Conditional Expressions
    • 🏭Deploy within your firewall
    • 🍉Benchmarking impact on your system
      • Java
      • Go
    • Benchmarking impact on your system:
Powered by GitBook
On this page
  1. CtrlB Live Debug
  2. Agents
  3. Go

Run with Docker

If you build your application in production using docker, there are certain system dependencies required, namely:

Debian

apt update && apt install -y libffi-dev zlib1g-dev libedit-dev libc++-13-dev libc++abi-13-dev

Alpine

apk add --no-cache gcc musl-dev zlib-static build-base

Most of these are already present in the official Golang docker images.

Important points to ensure in your Dockerfile:

  • Enable CGO while building your application. (default is enabled)

  • Remember to add the build flags: -gcflags="all=-N -l"

  • Install system dependencies.

Here is a sample Dockerfile to deploy our agent in your application.

FROM golang:1.20

# Set destination for COPY
WORKDIR /app

# Install necessary system dependencies, including zlib1g-dev
RUN apt-get update && apt-get install -y zlib1g-dev

# Download Go modules
COPY go.mod go.sum ./
RUN go mod download

# Copy the source code. Note the slash at the end, as explained in
# https://docs.docker.com/engine/reference/builder/#copy
COPY *.go ./

# Build
RUN CGO_ENABLED=1 GOOS=linux go build -gcflags="all=-N -l" -o /app

# Optional:
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
EXPOSE 5000

# Run
CMD ["/app"]
PreviousRun with GolandNextConfiguration

Last updated 1 year ago