mirror of https://github.com/kedacore/keda.git
chore: Don't send .git in docker context (#1753)
Signed-off-by: Guilhem Lettron <guilhem@barpilot.io> Context is lighter when running on remote docker server Image was not reproducible Azure ACR build ignore .git by default
This commit is contained in:
parent
33c3cdb61e
commit
69b69ba670
|
@ -0,0 +1,12 @@
|
|||
# Don't send .git context
|
||||
.git/
|
||||
|
||||
# Binaries
|
||||
/bin/
|
||||
/keda
|
||||
|
||||
# Dockerfiles
|
||||
Dockerfile
|
||||
Dockerfile.*
|
||||
|
||||
*.md
|
|
@ -1,7 +1,9 @@
|
|||
# Build the manager binary
|
||||
FROM golang:1.15.6 as builder
|
||||
|
||||
ARG BUILD_VERSION
|
||||
ARG BUILD_VERSION=main
|
||||
ARG GIT_COMMIT=HEAD
|
||||
ARG GIT_VERSION=main
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
|
@ -23,10 +25,8 @@ COPY api/ api/
|
|||
COPY controllers/ controllers/
|
||||
COPY pkg/ pkg/
|
||||
|
||||
COPY .git/ .git/
|
||||
|
||||
# Build
|
||||
RUN VERSION=${BUILD_VERSION} make manager-dockerfile
|
||||
RUN VERSION=${BUILD_VERSION} GIT_COMMIT=${GIT_COMMIT} GIT_VERSION=${GIT_VERSION} make manager-dockerfile
|
||||
|
||||
# Use distroless as minimal base image to package the manager binary
|
||||
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Build the manager binary
|
||||
FROM golang:1.15.6 as builder
|
||||
|
||||
ARG BUILD_VERSION
|
||||
ARG BUILD_VERSION=main
|
||||
ARG GIT_COMMIT=HEAD
|
||||
ARG GIT_VERSION=main
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
|
@ -23,12 +25,10 @@ COPY api/ api/
|
|||
COPY controllers/ controllers/
|
||||
COPY pkg/ pkg/
|
||||
|
||||
COPY .git/ .git/
|
||||
|
||||
RUN mkdir -p /apiserver.local.config/certificates && chmod -R 777 /apiserver.local.config
|
||||
|
||||
# Build
|
||||
RUN VERSION=${BUILD_VERSION} make adapter-dockerfile
|
||||
RUN VERSION=${BUILD_VERSION} GIT_COMMIT=${GIT_COMMIT} GIT_VERSION=${GIT_VERSION} make adapter-dockerfile
|
||||
|
||||
# Use distroless as minimal base image to package the manager binary
|
||||
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||
|
|
8
Makefile
8
Makefile
|
@ -14,8 +14,8 @@ ARCH ?=amd64
|
|||
CGO ?=0
|
||||
TARGET_OS ?=linux
|
||||
|
||||
GIT_VERSION = $(shell git describe --always --abbrev=7)
|
||||
GIT_COMMIT = $(shell git rev-list -1 HEAD)
|
||||
GIT_VERSION ?= $(shell git describe --always --abbrev=7)
|
||||
GIT_COMMIT ?= $(shell git rev-list -1 HEAD)
|
||||
DATE = $(shell date -u +"%Y.%m.%d.%H.%M.%S")
|
||||
|
||||
TEST_CLUSTER_NAME ?= keda-nightly-run-2
|
||||
|
@ -143,8 +143,8 @@ build: manifests set-version manager adapter
|
|||
|
||||
# Build the docker image
|
||||
docker-build:
|
||||
docker build . -t ${IMAGE_CONTROLLER} --build-arg BUILD_VERSION=${VERSION}
|
||||
docker build -f Dockerfile.adapter -t ${IMAGE_ADAPTER} . --build-arg BUILD_VERSION=${VERSION}
|
||||
docker build . -t ${IMAGE_CONTROLLER} --build-arg BUILD_VERSION=${VERSION} --build-arg GIT_VERSION=${GIT_VERSION} --build-arg GIT_COMMIT=${GIT_COMMIT}
|
||||
docker build -f Dockerfile.adapter -t ${IMAGE_ADAPTER} . --build-arg BUILD_VERSION=${VERSION} --build-arg GIT_VERSION=${GIT_VERSION} --build-arg GIT_COMMIT=${GIT_COMMIT}
|
||||
|
||||
# Build KEDA Operator binary
|
||||
.PHONY: manager
|
||||
|
|
Loading…
Reference in New Issue