Drop option to build without Docker in Makefile (#1204)

## Description

Having both option could possibly lead to issues with caching.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [x] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2022-10-19 12:22:06 +05:30 committed by GitHub
parent 64c796ff18
commit 17221f23d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 16 deletions

View File

@ -1,6 +1,5 @@
.PHONY: buildimage build dev shell check genclidocs _validatemdgen .PHONY: buildimage build dev shell check genclidocs _validatemdgen
# Specify `CORSO_USE_DOCKER=-1` to skip using Docker for builds
CORSO_BUILD_DIR := /tmp/.corsobuild CORSO_BUILD_DIR := /tmp/.corsobuild
CORSO_BUILD_CACHE := ${CORSO_BUILD_DIR}/cache CORSO_BUILD_CACHE := ${CORSO_BUILD_DIR}/cache
CORSO_BUILD_MOD := ${CORSO_BUILD_DIR}/mod CORSO_BUILD_MOD := ${CORSO_BUILD_DIR}/mod
@ -9,18 +8,11 @@ CORSO_REPO := /go/src/github.com/alcionai/corso
CORSO_LOCAL_PATH := $(shell git rev-parse --show-toplevel) CORSO_LOCAL_PATH := $(shell git rev-parse --show-toplevel)
CORSO_VERSION := $(shell git rev-parse --short HEAD) CORSO_VERSION := $(shell git rev-parse --short HEAD)
DOCSC := docker run --rm -it -p 3000:3000 -v ${PWD}:/usr/src/docs --env CORSO_VERSION=${CORSO_VERSION} corso/docs DOCSC := docker run --rm -it -p 3000:3000 -v ${PWD}:/usr/src/docs --env CORSO_VERSION=${CORSO_VERSION} corso/docs
DOCSE := ${DOCSC} # for enforcing docker container as environment
GOC := docker run --rm -it \ GOC := docker run --rm -it \
-v ${CORSO_LOCAL_PATH}:${CORSO_REPO} -v ${CORSO_BUILD_DIR}:${CORSO_BUILD_DIR} \ -v ${CORSO_LOCAL_PATH}:${CORSO_REPO} -v ${CORSO_BUILD_DIR}:${CORSO_BUILD_DIR} \
--env GOCACHE=${CORSO_BUILD_CACHE} --env GOMODCACHE=${CORSO_BUILD_MOD} --env GOTMPDIR=${CORSO_BUILD_DIR} \ --env GOCACHE=${CORSO_BUILD_CACHE} --env GOMODCACHE=${CORSO_BUILD_MOD} --env GOTMPDIR=${CORSO_BUILD_DIR} \
--workdir ${CORSO_REPO}/src \ --workdir ${CORSO_REPO}/src \
golang:1.18 golang:1.18
ifeq (${CORSO_USE_DOCKER},-1)
DOCSC :=
GOC := cd ${CORSO_LOCAL_PATH}/src &&
CORSO_REPO := ${CORSO_LOCAL_PATH}
endif
MDGEN_SRC := ${CORSO_REPO}/src/cmd/mdgen/mdgen.go MDGEN_SRC := ${CORSO_REPO}/src/cmd/mdgen/mdgen.go
MDGEN_BINARY := ${CORSO_BUILD_BIN}/mdgen MDGEN_BINARY := ${CORSO_BUILD_BIN}/mdgen
CLI_DOCS := ${CORSO_REPO}/docs/docs/cli CLI_DOCS := ${CORSO_REPO}/docs/docs/cli
@ -34,11 +26,15 @@ dev: genclidocs
VALE_TARGET ?= docs README.md VALE_TARGET ?= docs README.md
check: genclidocs check: genclidocs
vale $(VALE_TARGET)
markdownlint '**/*.md' --ignore styles/ --ignore src/ --ignore node_modules/
dockercheck: genclidocs
$(DOCSC) vale $(VALE_TARGET) $(DOCSC) vale $(VALE_TARGET)
$(DOCSC) markdownlint '**/*.md' --ignore styles/ --ignore src/ --ignore node_modules/ $(DOCSC) markdownlint '**/*.md' --ignore styles/ --ignore src/ --ignore node_modules/
dockershell: dockershell:
$(DOCSE) /bin/bash $(DOCSC) bash
build: genclidocs build: genclidocs
$(DOCSC) npm run build $(DOCSC) npm run build
@ -49,7 +45,7 @@ genclidocs: ${MDGEN_BINARY}
$(GOC) ${MDGEN_BINARY} --cli-folder ${CLI_DOCS} $(GOC) ${MDGEN_BINARY} --cli-folder ${CLI_DOCS}
_validatemdgen: # in case we have a different architecture _validatemdgen: # in case we have a different architecture
${MDGEN_BINARY} --help >/dev/null || rm -rf ${MDGEN_BINARY} $(GOC) ${MDGEN_BINARY} --help >/dev/null || $(GOC) rm -rf ${MDGEN_BINARY}
${MDGEN_BINARY}: $(shell find ${CORSO_LOCAL_PATH}/src -type f -name *.go) $(shell find ${CORSO_LOCAL_PATH}/src -type d ) _validatemdgen ${MDGEN_BINARY}: $(shell find ${CORSO_LOCAL_PATH}/src -type f -name *.go) $(shell find ${CORSO_LOCAL_PATH}/src -type d ) _validatemdgen
@echo 'Re-building Corso CLI docs auto-gen tooling...' @echo 'Re-building Corso CLI docs auto-gen tooling...'
@ -58,4 +54,4 @@ ${MDGEN_BINARY}: $(shell find ${CORSO_LOCAL_PATH}/src -type f -name *.go) $(shel
clean: clean:
$(DOCSC) rm -rf docs/cli $(DOCSC) rm -rf docs/cli
$(DOCSC) rm -rf ${CORSO_BUILD_DIR} $(GOC) rm -rf ${CORSO_BUILD_DIR}/*

View File

@ -1,10 +1,7 @@
.PHONY: buildimage dev shell build publish sync .PHONY: buildimage dev shell build publish sync
WEBC := docker run --rm -it --init -p 5050:3000 -p 5051:3001 \ WEBC := docker run --rm -it --init -p 5050:3000 -p 5051:3001 \
-v ${PWD}:/usr/src/website corso/website -v ${PWD}:/usr/src/website corso/website:latest
ifeq (${CORSO_USE_DOCKER},-1)
WEBC :=
endif
buildimage: buildimage:
docker build -t "corso/website:latest" . docker build -t "corso/website:latest" .
@ -20,7 +17,7 @@ build:
publish: build publish: build
docker run -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \ docker run -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \
-e AWS_SESSION_TOKEN --rm -v ${PWD}:/usr/src/website corso/website \ -e AWS_SESSION_TOKEN --rm -v ${PWD}:/usr/src/website corso/website:latest \
make sync make sync
sync: sync: