mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
Merge pull request #99059 from vinayakankugoyal/dockerfile2
Use ARG and --build-arg instead of sed for etcd image.
This commit is contained in:
commit
1f27dcf70c
@ -12,7 +12,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM BASEIMAGE as builder
|
||||
ARG BASEIMAGE
|
||||
ARG RUNNERIMAGE
|
||||
|
||||
FROM ${BASEIMAGE} as builder
|
||||
|
||||
# This image needs bash for running "migrate-if-needed.sh". Instead of a full debian image
|
||||
# we use just the bash-static and we wrap bash-static into a distroless image instead of
|
||||
@ -23,7 +26,7 @@ RUN apt-get update -y \
|
||||
|
||||
RUN cp /bin/bash-static /sh
|
||||
|
||||
FROM RUNNERIMAGE
|
||||
FROM ${RUNNERIMAGE}
|
||||
WORKDIR /
|
||||
|
||||
COPY --from=builder /sh /bin/
|
||||
|
@ -143,12 +143,13 @@ else
|
||||
cd $(TEMP_DIR) && echo "ENV ETCD_UNSUPPORTED_ARCH=$(ARCH)" >> Dockerfile
|
||||
endif
|
||||
|
||||
# Replace BASEIMAGE with the real base image
|
||||
cd $(TEMP_DIR) && sed -i.bak 's|BASEIMAGE|$(BASEIMAGE)|g' Dockerfile
|
||||
cd $(TEMP_DIR) && sed -i.bak 's|RUNNERIMAGE|$(RUNNERIMAGE)|g' Dockerfile
|
||||
|
||||
# And build the image
|
||||
docker build --pull -t $(REGISTRY)/etcd-$(ARCH):$(IMAGE_TAG) $(TEMP_DIR)
|
||||
docker build \
|
||||
--pull \
|
||||
-t $(REGISTRY)/etcd-$(ARCH):$(IMAGE_TAG) \
|
||||
--build-arg BASEIMAGE=$(BASEIMAGE) \
|
||||
--build-arg RUNNERIMAGE=$(RUNNERIMAGE) \
|
||||
$(TEMP_DIR)
|
||||
|
||||
push: build
|
||||
docker tag $(REGISTRY)/etcd-$(ARCH):$(IMAGE_TAG) $(MANIFEST_IMAGE)-$(ARCH):$(IMAGE_TAG)
|
||||
@ -181,8 +182,12 @@ unit-test:
|
||||
build-integration-test-image: build
|
||||
cp -r $(TEMP_DIR) $(TEMP_DIR)_integration_test
|
||||
cp Dockerfile $(TEMP_DIR)_integration_test/Dockerfile
|
||||
cd $(TEMP_DIR)_integration_test && sed -i.bak 's|BASEIMAGE|golang:$(GOLANG_VERSION)|g' Dockerfile
|
||||
docker build --pull -t etcd-integration-test $(TEMP_DIR)_integration_test
|
||||
docker build \
|
||||
--pull \
|
||||
-t etcd-integration-test \
|
||||
--build-arg BASEIMAGE=golang:$(GOLANG_VERSION) \
|
||||
--build-arg RUNNERIMAGE=$(RUNNERIMAGE) \
|
||||
$(TEMP_DIR)_integration_test
|
||||
|
||||
integration-test:
|
||||
docker run --interactive -v $(shell pwd)/../../../:/go/src/k8s.io/kubernetes$(DOCKER_VOL_OPTS) -e GOARCH=$(ARCH) etcd-integration-test \
|
||||
|
Loading…
Reference in New Issue
Block a user