Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(Makefile): fix build-docker label #91

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
22 changes: 21 additions & 1 deletion .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,27 @@ jobs:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4

- name: Get Go version from go.mod
id: get_go_version
run: |
go_version=$(make go-version)

- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # ratchet:actions/setup-go@v5
with:
go-version: ${{ steps.get_go_version.outputs.go_version }}

- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y clang
sudo apt install -y libbpf-dev
sudo apt install -y libseccomp-dev

- name: Build Docker image
run: make build-gh

- name: Log in to Docker Hub
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # ratchet:docker/login-action@v2
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
- name: Install BCC Dependencies
run: |
sudo apt update
sudo apt install -y libbpf-dev # Install libbpf dependencies
sudo apt install -y libseccomp-dev # Install Seccomp dependencies
sudo apt install -y clang
sudo apt install -y libbpf-dev
sudo apt install -y libseccomp-dev
- name: Build and Test
run: |-
run: |
make build-gh
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Minimal Base Image
FROM golang:1.23.2 AS builder

ARG GITHUB_REF_NAME=test
ENV GITHUB_REF_NAME=$GITHUB_REF_NAME

WORKDIR /workspace

# Install required dependencies
Expand All @@ -25,7 +28,7 @@ COPY go.sum go.sum
COPY Makefile Makefile

# Build harpoon
RUN make build
RUN make build-gh

# Final stage
FROM debian:bookworm-slim
Expand All @@ -48,4 +51,4 @@ COPY --from=builder /workspace/bin/harpoon .
# --pid=host \
# -v /sys/kernel/debug/:/sys/kernel/debug:rw \
# harpoon:latest
ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/bin/bash"]
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,21 @@ endif
-o ${BINARY_DIR}/${BINARY_NAME} \
.

build-docker: build
build-docker:
ifdef GITHUB_REF_NAME
docker build \
--no-cache \
--build-arg GO_VERSION=$(GO_VERSION) \
-t $(IMAGE_NAME):latest \
-t $(IMAGE_NAME):$(GITHUB_REF_NAME) \
.
--no-cache \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg GITHUB_REF_NAME=$(GITHUB_REF_NAME) \
-t $(IMAGE_NAME):latest \
-t $(IMAGE_NAME):$(GITHUB_REF_NAME) \
.
else
docker build \
--no-cache \
--build-arg GO_VERSION=$(GO_VERSION) \
-t $(IMAGE_NAME):latest \
.
--no-cache \
--build-arg GO_VERSION=$(GO_VERSION) \
-t $(IMAGE_NAME):latest \
.
endif

push-docker:
Expand Down
Loading