-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (47 loc) · 1.25 KB
/
Dockerfile
File metadata and controls
59 lines (47 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Use Ubuntu as base image for better eBPF support
FROM ubuntu:24.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV GO_VERSION=1.23.11
ENV BPFTRACE_VERSION=v0.23.5
# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
curl \
git \
build-essential \
clang \
llvm \
libelf-dev \
libbpf-dev \
pkg-config \
libsqlite3-dev \
linux-headers-generic \
libbpf-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Go
RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz \
&& rm go${GO_VERSION}.linux-amd64.tar.gz
# Set Go environment variables
ENV PATH=$PATH:/usr/local/go/bin
ENV GOPATH=/go
ENV GOCACHE=/go/cache
RUN apt-get update
# Build and install bpftrace from source
RUN wget https://github.com/bpftrace/bpftrace/releases/download/v0.23.5/bpftrace \
&& chmod +x bpftrace \
&& mv bpftrace /usr/local/bin/bpftrace
# Create app directory
WORKDIR /app
# Copy Go module files
COPY go.mod go.sum ./
# Download Go dependencies
RUN go mod download
# Copy source code
COPY . ./
COPY userland.go ./
# Build the Go application
RUN go generate && go build -o main
# Set the entrypoint
ENTRYPOINT ["./main"]