Skip to content

Commit

Permalink
Use single container for both daemonset and system extension
Browse files Browse the repository at this point in the history
  • Loading branch information
robinelfrink committed Mar 27, 2024
1 parent 2874e55 commit 6fac279
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 34 deletions.
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#### Build binary
FROM golang:1.22.1-alpine AS builder
WORKDIR /build
COPY . .
ARG TARGETARCH
ARG CGO_ENABLED=0
ARG GOARCH=$TARGETARCH
ARG GOARCH=amd64
ARG GOOS=linux
RUN go test -v ./... && \
go vet ./... && \
go build -ldflags="-s -w" -trimpath -o talos-vmtoolsd ./cmd/talos-vmtoolsd

#### Build system extension tree
FROM alpine:3.19 AS stage
RUN mkdir -p /stage/rootfs/usr/local/etc/containers
RUN mkdir -p /stage/rootfs/usr/local/lib/containers/talos-vmtoolsd
COPY --from=builder /build/talos-vmtoolsd /stage/rootfs/usr/local/lib/containers/talos-vmtoolsd/
COPY ./manifest.yaml /stage/
COPY ./talos-vmtoolsd.yaml /stage/rootfs/usr/local/etc/containers/

#### Build final container
FROM scratch
WORKDIR /bin
COPY --from=builder /build/talos-vmtoolsd /bin/talos-vmtoolsd
ENTRYPOINT ["/bin/talos-vmtoolsd"]
COPY --from=stage /stage /
ENTRYPOINT ["/rootfs/usr/local/lib/containers/talos-vmtoolsd/talos-vmtoolsd"]
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ talos-vmtoolsd:
docker-build:
docker buildx build . --tag $(REGISTRY_AND_USERNAME)/${IMAGE_NAME}:$(IMAGE_TAG) --file Dockerfile

docker-build-extension:
docker buildx build . --tag $(REGISTRY_AND_USERNAME)/${IMAGE_NAME}-system-extension:$(IMAGE_TAG) --file system-extension/Dockerfile

.PHONY: talos-vmtoolsd docker-build docker-build-extension
.PHONY: talos-vmtoolsd docker-build
File renamed without changes.
25 changes: 0 additions & 25 deletions system-extension/Dockerfile

This file was deleted.

File renamed without changes.

0 comments on commit 6fac279

Please sign in to comment.