-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathContainerfile
More file actions
48 lines (39 loc) · 1.43 KB
/
Copy pathContainerfile
File metadata and controls
48 lines (39 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Build environment for bink CLI with all C dependencies
ARG FEDORA_VERSION=44
FROM quay.io/fedora/fedora:${FEDORA_VERSION} AS builder
# Install Go and required C libraries for Podman bindings
RUN dnf install -y \
golang \
git \
gpgme-devel \
btrfs-progs-devel \
device-mapper-devel \
&& dnf clean all
WORKDIR /build
# Copy go.mod and go.sum first to cache dependencies separately
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
# Copy source and build
ARG VERSION=dev
COPY . /src
WORKDIR /output
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GIT_COMMIT=$(cd /src && git rev-parse --short HEAD 2>/dev/null || echo "") && \
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ) && \
VERSION_PKG=github.com/bootc-dev/bink/internal/version && \
cd /src && CGO_ENABLED=1 go build \
-ldflags "-X ${VERSION_PKG}.Version=${VERSION} -X ${VERSION_PKG}.GitCommit=${GIT_COMMIT} -X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" \
-o /output/bink ./cmd/bink
# Runtime image with just the binary and required C runtime libraries
FROM quay.io/fedora/fedora-minimal:${FEDORA_VERSION}
RUN dnf install -y \
gpgme \
podman \
kubernetes-client \
&& dnf clean all
COPY --from=builder /output/bink /usr/local/bin/bink
COPY containerfiles/bink/entrypoint.sh /usr/local/bin/entrypoint.sh
WORKDIR /output
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]