Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
FROM ubuntu:20.10

# Define variables.
ARG GOVERSION=1.15.15
ARG ARCH=amd64
FROM golang:1.20-bullseye

# Download development environment.
RUN apt-get update && \
apt-get install -y \
libbpf-dev \
make \
clang \
llvm \
libbpf-dev \
libelf-dev

# Install Go specific version.
RUN apt-get install -y wget && \
wget https://golang.org/dl/go${GOVERSION}.linux-${ARCH}.tar.gz && \
tar -xf go${GOVERSION}.linux-${ARCH}.tar.gz && \
mv go/ /usr/local/ && \
ln -s /usr/local/go/bin/go /usr/local/bin/ && \
rm -rf go${GOVERSION}.linux-${ARCH}.tar.gz

# Setup working directory.
RUN mkdir -p /app
WORKDIR /app

# Execute build command.
ENTRYPOINT ["/usr/bin/make", "all"]
ENTRYPOINT ["/usr/bin/make"]
CMD ["all"]
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ARCH=$(shell uname -m)
TARGET := hello
TARGET_BPF := $(TARGET).bpf.o

GO_SRC := *.go
BPF_SRC := *.bpf.c
GO_SRC := *.go Makefile
BPF_SRC := *.bpf.c *.bpf.h Makefile

LIBBPF_HEADERS := /usr/include/bpf
LIBBPF_OBJ := /usr/lib/$(ARCH)-linux-gnu/libbpf.a
Expand All @@ -14,7 +14,7 @@ all: $(TARGET) $(TARGET_BPF)

go_env := CC=clang CGO_CFLAGS="-I $(LIBBPF_HEADERS)" CGO_LDFLAGS="$(LIBBPF_OBJ)"
$(TARGET): $(GO_SRC)
$(go_env) go build -o $(TARGET)
$(go_env) go build -o $(TARGET) -buildvcs=false

$(TARGET_BPF): $(BPF_SRC)
clang \
Expand All @@ -25,4 +25,3 @@ $(TARGET_BPF): $(BPF_SRC)
.PHONY: clean
clean:
go clean