-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.debug
47 lines (37 loc) · 2.07 KB
/
Dockerfile.debug
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
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.22.1 as builder
WORKDIR /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
ADD . .
ARG STAGINGVERSION
ARG TARGETPLATFORM
RUN CGO_ENABLED=0 go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest
RUN GOARCH="$(echo $TARGETPLATFORM | cut -f2 -d '/')" GCE_PD_CSI_STAGING_VERSION=$STAGINGVERSION GCE_PD_CSI_DEBUG=1 make gce-pd-driver
# MAD HACKS: Build a version first so we can take the scsi_id bin and put it somewhere else in our real build
FROM gke.gcr.io/debian-base:bullseye-v1.4.3-gke.0 as mad-hack
RUN clean-install udev
# Start from Kubernetes Debian base
FROM gke.gcr.io/debian-base:bullseye-v1.4.3-gke.0
# Copy source code too to correlate the binary and the breakpoints
WORKDIR /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
ADD . .
COPY --from=builder /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver
COPY --from=builder /go/bin/dlv /go/bin/dlv
# Install necessary dependencies
RUN clean-install util-linux e2fsprogs mount ca-certificates udev xfsprogs
COPY --from=mad-hack /lib/udev/scsi_id /lib/udev_containerized/scsi_id
# PDCSI driver isn't copied to / because of delve not being able to correlate
# the binary and the source code, instead just run the binary where it was
# compiled, the overlay noauth-debug calls this binary
ENTRYPOINT ["/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver"]