update dind machine image to run dockerd in background

This commit is contained in:
Pavel Sviderski
2024-11-27 10:35:49 +10:00
parent 6e0df53f13
commit 410f74425c
3 changed files with 21 additions and 3 deletions
+1
View File
@@ -4,6 +4,7 @@
# Allow files and directories. # Allow files and directories.
!cmd/ !cmd/
!internal/ !internal/
!scripts/docker-entrypoint.sh
!go.* !go.*
# Ignore unnecessary files inside allowed directories. # Ignore unnecessary files inside allowed directories.
+14 -3
View File
@@ -3,6 +3,13 @@ FROM golang:1.23.2-alpine AS uncloudd
ARG TARGETOS ARG TARGETOS
ARG TARGETARCH ARG TARGETARCH
ENV CGO_ENABLED=0
WORKDIR /build
# Download and cache dependencies and only redownload them in subsequent builds if they change.
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . . COPY . .
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o uncloudd cmd/uncloudd/main.go RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o uncloudd cmd/uncloudd/main.go
@@ -15,15 +22,19 @@ RUN wget -q -O /tmp/corrosion.tar.gz \
&& rm /tmp/corrosion.tar.gz /tmp/corrosion && rm /tmp/corrosion.tar.gz /tmp/corrosion
FROM chainguard/wolfi-base:latest AS corrosion FROM chainguard/wolfi-base:latest AS corrosion
# TODO: create uncloud user
COPY --from=corrosion-download /usr/local/bin/corrosion /usr/local/bin/corrosion COPY --from=corrosion-download /usr/local/bin/corrosion /usr/local/bin/corrosion
CMD ["corrosion", "agent"]
FROM docker:27.3.1-dind FROM docker:27.3.1-dind AS machine
RUN apk --no-cache add \ RUN apk --no-cache add \
wireguard-tools wireguard-tools
# Create system group and user 'uncloud'. # Create system group and user 'uncloud'.
RUN addgroup -S uncloud && adduser -SHD -h /nonexistent -G uncloud -g "" uncloud RUN addgroup -S uncloud && adduser -SHD -h /nonexistent -G uncloud -g "" uncloud
COPY --from=uncloudd /go/uncloudd /usr/local/bin/uncloudd
COPY scripts/docker-entrypoint.sh /usr/local/bin/
COPY --from=uncloudd /build/uncloudd /usr/local/bin/
# TODO: socat to forward uncloud.sock unix socket? # TODO: socat to forward uncloud.sock unix socket?
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["uncloudd"] CMD ["uncloudd"]
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
set -eu
dind dockerd &
exec "$@"