Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Commit 533673e

Browse files
committed
feat: Add basic dibs configuration for dhclientd
1 parent 10d4d5f commit 533673e

File tree

3 files changed

+141
-2
lines changed

3 files changed

+141
-2
lines changed

Dockerfile.dhclientd

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# syntax=docker/dockerfile:experimental
2+
# Build container
3+
FROM --platform=$TARGETPLATFORM golang AS build
4+
ARG DIBS_TARGET
5+
ARG TARGETPLATFORM
6+
7+
WORKDIR /app
8+
9+
RUN apt update
10+
RUN apt install -y protobuf-compiler gcc make git file
11+
12+
RUN curl -Lo /tmp/dibs https://github.com/pojntfx/dibs/releases/latest/download/dibs-linux-amd64
13+
RUN install /tmp/dibs /usr/local/bin
14+
15+
ENV GO111MODULE=on
16+
17+
RUN go get github.com/golang/protobuf/protoc-gen-go
18+
RUN go get github.com/rakyll/statik
19+
20+
ADD . .
21+
22+
RUN dibs -generateSources
23+
RUN dibs -build
24+
25+
# Run container
26+
FROM --platform=$TARGETPLATFORM debian
27+
ARG DIBS_TARGET
28+
ARG TARGETPLATFORM
29+
30+
COPY --from=build /app/.bin/binaries/dhclientd* /usr/local/bin/dhclientd
31+
32+
CMD /usr/local/bin/dhclientd

Dockerfile.dhcpdd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ FROM --platform=$TARGETPLATFORM debian
2727
ARG DIBS_TARGET
2828
ARG TARGETPLATFORM
2929

30-
COPY --from=build /app/.bin/binaries/dhcpd* /usr/local/bin/dhcpd
30+
COPY --from=build /app/.bin/binaries/dhcpdd* /usr/local/bin/dhcpdd
3131

32-
CMD /usr/local/bin/dhcpd
32+
CMD /usr/local/bin/dhcpdd

dibs.yaml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,110 @@ targets:
173173
unitTests: go test -v ./...
174174
integrationTests: .bin/binaries/dhcpdctl-darwin-amd64 --help
175175
start: .bin/binaries/dhcpdctl-darwin-amd64 --help
176+
- name: dhclientd-linux
177+
helm:
178+
src: charts/dhclientd
179+
dist: .bin/chart
180+
dockerManifest: pojntfx/dhclientd:latest
181+
platforms:
182+
- identifier: linux/amd64
183+
paths:
184+
watch: .
185+
include: (.*)\.go
186+
assetInImage: /usr/local/bin/dhclientd
187+
assetOut: .bin/binaries/dhclientd-linux-amd64
188+
gitRepoRoot: .
189+
commands:
190+
generateSources: go generate ./...
191+
build: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo -ldflags '-extldflags "-static"' -o .bin/binaries/dhclientd-linux-amd64 cmd/dhclientd/main.go
192+
unitTests: go test -v ./...
193+
integrationTests: .bin/binaries/dhclientd-linux-amd64 --help
194+
imageTests: docker run --platform linux/amd64 -e DIBS_TARGET=dhclientd-linux -e TARGETPLATFORM=linux/amd64 pojntfx/dhclientd:linux-amd64 /usr/local/bin/dhclientd --help
195+
chartTests: helm install dhclientd .bin/chart/dhclientd-*.tgz && helm delete dhclientd
196+
start: |
197+
if [ "$DIBS_DEBUG" = "true" ]; then
198+
pkill -9 dlv || true
199+
pkill -9 dhclientd || true
200+
.bin/binaries/dhclientd-linux-amd64 &
201+
dlv attach $! --headless --listen=:31441 --api-version=2 --accept-multiclient || true
202+
else
203+
.bin/binaries/dhclientd-linux-amd64
204+
fi
205+
docker:
206+
build:
207+
file: Dockerfile.dhclientd
208+
context: .
209+
tag: pojntfx/dhclientd:linux-amd64
210+
unitTests:
211+
file: Dockerfile.unitTests
212+
context: .
213+
tag: pojntfx/dhclientd-unit-tests:linux-amd64
214+
integrationTests:
215+
file: Dockerfile.integrationTests
216+
context: .
217+
tag: pojntfx/dhclientd-integration-tests:linux-amd64
218+
chartTests:
219+
file: Dockerfile.chartTests
220+
context: .
221+
tag: pojntfx/dhclientd-chart-tests:linux-amd64
222+
- identifier: linux/arm64
223+
paths:
224+
watch: .
225+
include: (.*)\.go
226+
assetInImage: /usr/local/bin/dhclientd
227+
assetOut: .bin/binaries/dhclientd-linux-arm64
228+
gitRepoRoot: .
229+
commands:
230+
generateSources: go generate ./...
231+
build: GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -tags netgo -ldflags '-extldflags "-static"' -o .bin/binaries/dhclientd-linux-arm64 cmd/dhclientd/main.go
232+
unitTests: go test -v ./...
233+
integrationTests: .bin/binaries/dhclientd-linux-arm64 --help
234+
imageTests: docker run --platform linux/arm64 -e DIBS_TARGET=dhclientd-linux -e TARGETPLATFORM=linux/arm64 pojntfx/dhclientd:linux-arm64 /usr/local/bin/dhclientd --help
235+
chartTests: helm install dhclientd .bin/chart/dhclientd-*.tgz && helm delete dhclientd
236+
start: |
237+
if [ "$DIBS_DEBUG" = "true" ]; then
238+
pkill -9 dlv || true
239+
pkill -9 dhclientd || true
240+
.bin/binaries/dhclientd-linux-arm64 &
241+
dlv attach $! --headless --listen=:31441 --api-version=2 --accept-multiclient || true
242+
else
243+
.bin/binaries/dhclientd-linux-arm64
244+
fi
245+
docker:
246+
build:
247+
file: Dockerfile.dhclientd
248+
context: .
249+
tag: pojntfx/dhclientd:linux-arm64
250+
unitTests:
251+
file: Dockerfile.unitTests
252+
context: .
253+
tag: pojntfx/dhclientd-unit-tests:linux-arm64
254+
integrationTests:
255+
file: Dockerfile.integrationTests
256+
context: .
257+
tag: pojntfx/dhclientd-integration-tests:linux-arm64
258+
chartTests:
259+
file: Dockerfile.chartTests
260+
context: .
261+
tag: pojntfx/dhclientd-chart-tests:linux-arm64
262+
- name: dhclientd-darwin
263+
platforms:
264+
- identifier: darwin/amd64
265+
paths:
266+
watch: .
267+
include: (.*)\.go
268+
gitRepoRoot: .
269+
commands:
270+
generateSources: go generate ./...
271+
build: GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo -ldflags '-extldflags "-static"' -o .bin/binaries/dhclientd-linux-amd64 cmd/dhclientd/main.go
272+
unitTests: go test -v ./...
273+
integrationTests: .bin/binaries/dhclientd-darwin-amd64 --help
274+
start: |
275+
if [ "$DIBS_DEBUG" = "true" ]; then
276+
pkill -9 dlv || true
277+
pkill -9 dhclientd || true
278+
.bin/binaries/dhclientd-darwin-amd64 &
279+
dlv attach $! --headless --listen=:31441 --api-version=2 --accept-multiclient || true
280+
else
281+
.bin/binaries/dhclientd-darwin-amd64
282+
fi

0 commit comments

Comments
 (0)