mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
docker: Add make variable to add docker build args (#48942)
Summary: Adds an extra make variable 'EXTRA_DOCKER_BUILD_FLAGS' that allows us to add extra docker build flags to the docker build command. Example: make -f docker.Makefile EXTRA_DOCKER_BUILD_FLAGS=--no-cache devel-image Signed-off-by: Eli Uriegas <eliuriegas@fb.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/48942 Reviewed By: walterddr Differential Revision: D25376288 Pulled By: seemethere fbshipit-source-id: 9cf2c2a5e01d505fa54447604ecd653dcbdd42e1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5533be5170
commit
881e9583b2
@ -1,31 +1,38 @@
|
||||
DOCKER_REGISTRY = docker.io
|
||||
DOCKER_ORG = $(shell docker info 2>/dev/null | sed '/Username:/!d;s/.* //')
|
||||
DOCKER_IMAGE = pytorch
|
||||
DOCKER_FULL_NAME = $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE)
|
||||
DOCKER_REGISTRY = docker.io
|
||||
DOCKER_ORG = $(shell docker info 2>/dev/null | sed '/Username:/!d;s/.* //')
|
||||
DOCKER_IMAGE = pytorch
|
||||
DOCKER_FULL_NAME = $(DOCKER_REGISTRY)/$(DOCKER_ORG)/$(DOCKER_IMAGE)
|
||||
|
||||
ifeq ("$(DOCKER_ORG)","")
|
||||
$(warning WARNING: No docker user found using results from whoami)
|
||||
DOCKER_ORG = $(shell whoami)
|
||||
DOCKER_ORG = $(shell whoami)
|
||||
endif
|
||||
|
||||
CUDA_VERSION = 11.0
|
||||
CUDNN_VERSION = 8
|
||||
BASE_RUNTIME = ubuntu:18.04
|
||||
BASE_DEVEL = nvidia/cuda:$(CUDA_VERSION)-cudnn$(CUDNN_VERSION)-devel-ubuntu18.04
|
||||
CUDA_VERSION = 11.0
|
||||
CUDNN_VERSION = 8
|
||||
BASE_RUNTIME = ubuntu:18.04
|
||||
BASE_DEVEL = nvidia/cuda:$(CUDA_VERSION)-cudnn$(CUDNN_VERSION)-devel-ubuntu18.04
|
||||
|
||||
# The conda channel to use to install pytorch / torchvision
|
||||
INSTALL_CHANNEL = pytorch
|
||||
INSTALL_CHANNEL = pytorch
|
||||
|
||||
PYTHON_VERSION = 3.7
|
||||
PYTHON_VERSION = 3.7
|
||||
# Can be either official / dev
|
||||
BUILD_TYPE = dev
|
||||
BUILD_PROGRESS = auto
|
||||
BUILD_ARGS = --build-arg BASE_IMAGE=$(BASE_IMAGE) \
|
||||
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
|
||||
--build-arg CUDA_VERSION=$(CUDA_VERSION) \
|
||||
--build-arg INSTALL_CHANNEL=$(INSTALL_CHANNEL)
|
||||
DOCKER_BUILD = DOCKER_BUILDKIT=1 docker build --progress=$(BUILD_PROGRESS) --target $(BUILD_TYPE) -t $(DOCKER_FULL_NAME):$(DOCKER_TAG) $(BUILD_ARGS) .
|
||||
DOCKER_PUSH = docker push $(DOCKER_FULL_NAME):$(DOCKER_TAG)
|
||||
BUILD_TYPE = dev
|
||||
BUILD_PROGRESS = auto
|
||||
BUILD_ARGS = --build-arg BASE_IMAGE=$(BASE_IMAGE) \
|
||||
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
|
||||
--build-arg CUDA_VERSION=$(CUDA_VERSION) \
|
||||
--build-arg INSTALL_CHANNEL=$(INSTALL_CHANNEL)
|
||||
EXTRA_DOCKER_BUILD_FLAGS ?=
|
||||
DOCKER_BUILD = DOCKER_BUILDKIT=1 \
|
||||
docker build \
|
||||
--progress=$(BUILD_PROGRESS) \
|
||||
$(EXTRA_DOCKER_BUILD_FLAGS) \
|
||||
--target $(BUILD_TYPE) \
|
||||
-t $(DOCKER_FULL_NAME):$(DOCKER_TAG) \
|
||||
$(BUILD_ARGS) .
|
||||
DOCKER_PUSH = docker push $(DOCKER_FULL_NAME):$(DOCKER_TAG)
|
||||
|
||||
.PHONY: all
|
||||
all: devel-image
|
||||
|
Reference in New Issue
Block a user