Skip to content

Commit 563e40a

Browse files
Merge pull request #784 from jwstein3400/main
🌱 build: introduce support for FROM overrides
2 parents e735768 + 06c22c1 commit 563e40a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# Support FROM override
16+
ARG BUILD_IMAGE=docker.io/golang:1.19
17+
ARG BASE_IMAGE=gcr.io/distroless/static:nonroot
18+
1519
# Build the manager binary on golang image
16-
FROM docker.io/golang:1.19 as builder
20+
FROM $BUILD_IMAGE as builder
1721
WORKDIR /workspace
1822

1923
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
@@ -42,7 +46,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
4246
-o manager .
4347

4448
# Copy the controller-manager into a thin image
45-
FROM gcr.io/distroless/static:nonroot
49+
FROM $BASE_IMAGE
4650
WORKDIR /
4751
COPY --from=builder /workspace/manager .
4852
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies

0 commit comments

Comments
 (0)