Skip to content

Commit 6f29c97

Browse files
authored
feat: add Github Actions to release clusterloader2 (#4)
1 parent 01238fe commit 6f29c97

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build and Push Docker Image for clusterloader2
2+
3+
on:
4+
push:
5+
paths:
6+
- "clusterloader2/**"
7+
tags:
8+
- "v*"
9+
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
packages: write
15+
contents: read
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Build and push image
29+
run: |
30+
cd clusterloader2
31+
make build-image
32+
make push-image
33+
env:
34+
IMAGE_REPO: ghcr.io/${{ github.repository_owner }}
35+
IMAGE_TAG: ${{ github.ref_name }}

clusterloader2/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ARG GOLANG_VERSION=1.22
2+
FROM golang:${GOLANG_VERSION} AS builder
3+
4+
WORKDIR /root/perf-tests/clusterloader2
5+
COPY . .
6+
RUN go build -o clusterloader2 ./cmd/
7+
8+
FROM ubuntu:22.04
9+
RUN apt-get update && apt-get install -y curl unzip
10+
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
11+
&& unzip awscliv2.zip \
12+
&& ./aws/install \
13+
&& rm -rf awscliv2.zip aws
14+
COPY --from=builder /root/perf-tests /root/perf-tests
15+
RUN mkdir $GOPATH/src/k8s.io -p && \
16+
cp /root/perf-tests $GOPATH/src/k8s.io/perf-tests -r
17+
WORKDIR /root/perf-tests/clusterloader2
18+
ENTRYPOINT ["./clusterloader2"]

clusterloader2/Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
DOCKERFILE = Dockerfile
2+
IMAGE_REPO ?= localhost:5000
3+
IMAGE_REPO := $(shell echo $(IMAGE_REPO) | tr '[:upper:]' '[:lower:]')
4+
IMAGE_TAG ?= latest
5+
IMAGE_NAME = $(IMAGE_REPO)/clusterloader2:$(IMAGE_TAG)
6+
7+
PHONY: build-image push-image all
8+
9+
all: build-image push-image
10+
11+
build-image:
12+
docker build -t $(IMAGE_NAME) -f $(DOCKERFILE) .
13+
14+
push-image:
15+
docker push $(IMAGE_NAME)

0 commit comments

Comments
 (0)