github.com/kanishk98/terraform@v1.3.0-dev.0.20220917174235-661ca8088a6a/Makefile (about)

     1  WEBSITE_REPO=github.com/hashicorp/terraform-website
     2  VERSION?="0.3.44"
     3  PWD=$$(pwd)
     4  DOCKER_IMAGE="hashicorp/terraform-website:full"
     5  DOCKER_IMAGE_LOCAL="hashicorp-terraform-website-local"
     6  DOCKER_RUN_FLAGS=--interactive \
     7  	--rm \
     8  	--tty \
     9  	--workdir "/website" \
    10  	--volume "$(shell pwd):/website/ext/terraform" \
    11  	--volume "$(shell pwd)/website:/website/preview" \
    12  	--publish "3000:3000" \
    13  	-e "IS_CONTENT_PREVIEW=true" \
    14  	-e "PREVIEW_FROM_REPO=terraform" \
    15  	-e "NAV_DATA_DIRNAME=./preview/data" \
    16  	-e "CONTENT_DIRNAME=./preview/docs" \
    17  	-e "CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)"
    18  
    19  # generate runs `go generate` to build the dynamically generated
    20  # source files, except the protobuf stubs which are built instead with
    21  # "make protobuf".
    22  generate:
    23  	go generate ./...
    24  
    25  # We separate the protobuf generation because most development tasks on
    26  # Terraform do not involve changing protobuf files and protoc is not a
    27  # go-gettable dependency and so getting it installed can be inconvenient.
    28  #
    29  # If you are working on changes to protobuf interfaces, run this Makefile
    30  # target to be sure to regenerate all of the protobuf stubs using the expected
    31  # versions of protoc and the protoc Go plugins.
    32  protobuf:
    33  	go run ./tools/protobuf-compile .
    34  
    35  fmtcheck:
    36  	"$(CURDIR)/scripts/gofmtcheck.sh"
    37  
    38  importscheck:
    39  	"$(CURDIR)/scripts/goimportscheck.sh"
    40  
    41  staticcheck:
    42  	"$(CURDIR)/scripts/staticcheck.sh"
    43  
    44  exhaustive:
    45  	"$(CURDIR)/scripts/exhaustive.sh"
    46  
    47  # Default: run this if working on the website locally to run in watch mode.
    48  website:
    49  	@echo "==> Downloading latest Docker image..."
    50  	@docker pull ${DOCKER_IMAGE}
    51  	@echo "==> Starting website in Docker..."
    52  	@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE} npm start
    53  
    54  website/local:
    55  	@echo "==> Starting website in Docker..."
    56  	@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE_LOCAL} npm start
    57  
    58  .PHONY: website/build-local
    59  website/build-local:
    60  	@echo "==> Building local Docker image"
    61  	@docker build https://github.com/hashicorp/terraform-website.git\#master \
    62  		-t $(DOCKER_IMAGE_LOCAL)
    63  
    64  # disallow any parallelism (-j) for Make. This is necessary since some
    65  # commands during the build process create temporary files that collide
    66  # under parallel conditions.
    67  .NOTPARALLEL:
    68  
    69  .PHONY: fmtcheck importscheck generate protobuf website website-test staticcheck website/local website/build-local