Merge branch '145-build-system-rewrite' of https://dev.azure.com/fraport/Fahrerausbildung/_git/FRADrive into 145-build-system-rewrite
This commit is contained in:
commit
1b5c02fffd
211
Makefile
211
Makefile
@ -7,17 +7,19 @@ export CONTAINER_COMMAND ?= podman
|
|||||||
export CONTAINER_BGRUN ?= $(CONTAINER_COMMAND) run -dit --network=host --replace
|
export CONTAINER_BGRUN ?= $(CONTAINER_COMMAND) run -dit --network=host --replace
|
||||||
export CONTAINER_FGRUN ?= $(CONTAINER_COMMAND) run -it --network=host --replace
|
export CONTAINER_FGRUN ?= $(CONTAINER_COMMAND) run -it --network=host --replace
|
||||||
|
|
||||||
export CONTAINER_NAME ?= $(FRADRIVE_SERVICE)
|
#export CONTAINER_NAME ?= $(FRADRIVE_SERVICE)
|
||||||
export ENTRYPOINT
|
export ENTRYPOINT
|
||||||
|
|
||||||
export IN_CONTAINER ?= false
|
export IN_CONTAINER ?= false
|
||||||
export IN_CI ?= false
|
export IN_CI ?= false
|
||||||
|
|
||||||
|
export SINGLETON
|
||||||
export WATCH
|
export WATCH
|
||||||
export UNIWORXDB_OPTS ?= -cf
|
export UNIWORXDB_OPTS ?= -cf
|
||||||
|
|
||||||
export CONTAINER_ID
|
export CONTAINER_ID
|
||||||
export FRADRIVE_SERVICE
|
export FRADRIVE_SERVICE
|
||||||
|
export SERVICE_VARIANT
|
||||||
|
|
||||||
export DEV_PORT_HTTP
|
export DEV_PORT_HTTP
|
||||||
export DEV_PORT_HTTPS
|
export DEV_PORT_HTTPS
|
||||||
@ -89,12 +91,65 @@ release:
|
|||||||
.PHONY: %-shell
|
.PHONY: %-shell
|
||||||
# HELP: launch shell (bash) inside a currently running container
|
# HELP: launch shell (bash) inside a currently running container
|
||||||
%-shell: --%-shell;
|
%-shell: --%-shell;
|
||||||
--%-shell:
|
--shell:
|
||||||
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) fradrive.$(CURR_DEV).$* $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) fradrive.$(CURR_DEV).$* $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
||||||
|
|
||||||
|
compile-%: --%-containerized-compile;
|
||||||
|
|
||||||
##### GENERAL TARGETS #####
|
##### GENERAL TARGETS #####
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
|
##############################################
|
||||||
|
##### SERVICE DEPENDENCIES AND VARIABLES #####
|
||||||
|
|
||||||
|
--frontend-%: FRADRIVE_SERVICE=frontend
|
||||||
|
--frontend-%: SERVICE_VARIANT=frontend
|
||||||
|
--frontend-%: SINGLETON = false
|
||||||
|
--frontend-%: WATCH = false
|
||||||
|
--frontend-%:
|
||||||
|
# TODO --containerized-% is not yet working; comment this in again as soon as it does
|
||||||
|
# $(MAKE) -- --containerized-static --containerized-well-known
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
--backend-%: FRADRIVE_SERVICE=backend
|
||||||
|
--backend-%: SERVICE_VARIANT=backend
|
||||||
|
--backend-%: BASE_PORTS = "DEV_PORT_HTTP=3000" "DEV_PORT_HTTPS=3443"
|
||||||
|
--backend-%: SINGLETON = false
|
||||||
|
--backend-%:
|
||||||
|
$(MAKE) -- --frontend-containerized-compile
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
--hoogle-%: FRADRIVE_SERVICE=backend
|
||||||
|
--hoogle-%: SERVICE_VARIANT=hoogle
|
||||||
|
--hoogle-%: BASE_PORTS = "HOOGLE_PORT=8081"
|
||||||
|
--hoogle-%: SINGLETON = true
|
||||||
|
--hoogle-%:
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
# --uniworxdb was --db in old versions
|
||||||
|
--uniworxdb-%: FRADRIVE_SERVICE=backend
|
||||||
|
--uniworxdb-%: SERVICE_VARIANT=uniworxdb
|
||||||
|
--uniworxdb-%:
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
--minio-%: FRADRIVE_SERVICE=minio
|
||||||
|
--minio-%: SERVICE_VARIANT=minio
|
||||||
|
--minio-%:
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
--memcached-%: FRADRIVE_SERVICE=memcached
|
||||||
|
--memcached-%: SERVICE_VARIANT=memcached
|
||||||
|
--memcached-%:
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
# --postgres was --database in old versions
|
||||||
|
--postgres-%: BASE_PORTS = "PGPORT=5432"
|
||||||
|
--postgres-%: SINGLETON = true
|
||||||
|
--postgres-%:
|
||||||
|
$(MAKE) -- --$*
|
||||||
|
|
||||||
|
##### SERVICE DEPENDENCIES AND VARIABLES #####
|
||||||
|
##############################################
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
##### UNIFIED FRONTEND/BACKEND TARGETS #####
|
##### UNIFIED FRONTEND/BACKEND TARGETS #####
|
||||||
@ -109,7 +164,7 @@ compile:
|
|||||||
$(MAKE) compile-frontend
|
$(MAKE) compile-frontend
|
||||||
$(MAKE) compile-backend
|
$(MAKE) compile-backend
|
||||||
|
|
||||||
compile-%: --develop
|
--compile-%: --checkvarsset --develop --%
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
# HELP: lint frontend and backend
|
# HELP: lint frontend and backend
|
||||||
@ -122,31 +177,54 @@ test: start-database test-frontend test-backend i18n-check;
|
|||||||
##### UNIFIED FRONTEND/BACKEND TARGETS #####
|
##### UNIFIED FRONTEND/BACKEND TARGETS #####
|
||||||
############################################
|
############################################
|
||||||
|
|
||||||
|
--checkvarsset:
|
||||||
|
echo "FS:$(FRADRIVE_SERVICE) SV:$(SERVICE_VARIANT) DE:$(DEVELOP) CF:$(CONTAINER_FILE)"
|
||||||
|
@:
|
||||||
|
ifeq "$(FRADRIVE_SERVICE)" ""
|
||||||
|
>&2 echo "Variable FRADRIVE_SERVICE is not set; this hints to an internal error in the Makefile unless you have manually requested a '--'-target"
|
||||||
|
exit 1
|
||||||
|
endif
|
||||||
|
ifeq "$(SERVICE_VARIANT)" ""
|
||||||
|
>&2 echo "Variable SERVICE_VARIANT is not set; this hints to an internal error in the Makefile unless you have manually requested a '--'-target"
|
||||||
|
exit 1
|
||||||
|
endif
|
||||||
|
#ifeq "$(DEVELOP)" ""
|
||||||
|
# >&2 echo "Variable DEVELOP is not set; this hints to an internal error in the Makefile unless you have manually requested a '--'-target"
|
||||||
|
# exit 1
|
||||||
|
#endif
|
||||||
|
#ifeq "$(CONTAINER_FILE)" ""
|
||||||
|
# >&2 echo "Variable CONTAINER_FILE is not set; this hints to an internal error in the Makefile unless you have manually requested a '--'-target"
|
||||||
|
# exit 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
##### FRONTEND TARGETS #####
|
##### FRONTEND TARGETS #####
|
||||||
|
|
||||||
.PHONY: %-frontend
|
#--frontend-%: --image-build --containerized---%-frontend;
|
||||||
%-frontend: FRADRIVE_SERVICE=frontend
|
|
||||||
%-frontend: --image-build --containerized---%-frontend;
|
|
||||||
|
|
||||||
--%-frontend: --containerized-static-frontend --containerized-well-known-frontend
|
#--%-frontend: --containerized-static-frontend --containerized-well-known-frontend
|
||||||
|
|
||||||
--start-frontend: static
|
#--frontend-start: static
|
||||||
|
# npm run start
|
||||||
|
|
||||||
|
ifeq ($(SERVICE_VARIANT), frontend)
|
||||||
|
--start: --checkvarsset
|
||||||
npm run start
|
npm run start
|
||||||
|
|
||||||
# HELP(compile-frontend): compile frontend
|
# HELP(compile-frontend): compile frontend
|
||||||
--compile-frontend: static well-known;
|
--compile: static well-known --checkvarsset;
|
||||||
|
|
||||||
# HELP(lint-frontend): lint frontend
|
# HELP(lint-frontend): lint frontend
|
||||||
--lint-frontend: eslint.config.js
|
--lint: eslint.config.js --checkvarsset
|
||||||
npx -- eslint frontend/src $(FIX)
|
npx -- eslint frontend/src $(FIX)
|
||||||
@echo Hooray! There are no hints.
|
@echo Hooray! There are no hints.
|
||||||
|
|
||||||
# HELP(test-frontend): test frontend
|
# HELP(test-frontend): test frontend
|
||||||
--test-frontend: karma.conf.cjs
|
--test: karma.conf.cjs --checkvarsset
|
||||||
@echo Karma frontend tests are currently broken after npm update and have therefor been temporarily disabled.
|
@echo Karma frontend tests are currently broken after npm update and have therefor been temporarily disabled.
|
||||||
# npx -- karma start --conf karma.conf.cjs $(WATCH)
|
# npx -- karma start --conf karma.conf.cjs $(WATCH)
|
||||||
|
endif
|
||||||
|
|
||||||
node_modules: package.json package-lock.json
|
node_modules: package.json package-lock.json
|
||||||
npm ci --cache .npm --prefer-offline
|
npm ci --cache .npm --prefer-offline
|
||||||
@ -157,10 +235,10 @@ package-lock.json: package.json
|
|||||||
assets: assets/favicons assets/icons;
|
assets: assets/favicons assets/icons;
|
||||||
assets/favicons:
|
assets/favicons:
|
||||||
./utils/faviconize.pl assets/favicon.svg long assets/favicons
|
./utils/faviconize.pl assets/favicon.svg long assets/favicons
|
||||||
assets/icons: node_modules utils/rename-fa.json
|
assets/icons: node_modules assets/icons-src/fontawesome.json
|
||||||
./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/solid assets/icons-src/fontawesome.json assets/icons/fradrive
|
./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/solid assets/icons-src/fontawesome.json assets/icons/fradrive
|
||||||
./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/regular assets/icons-src/fontawesome.json assets/icons/fradrive
|
./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/regular assets/icons-src/fontawesome.json assets/icons/fradrive
|
||||||
cp assets/icons-src/*.svg assets/icons/fradrive
|
-cp assets/icons-src/*.svg assets/icons/fradrive
|
||||||
static: node_modules assets esbuild.config.mjs
|
static: node_modules assets esbuild.config.mjs
|
||||||
npm run build
|
npm run build
|
||||||
well-known: static;
|
well-known: static;
|
||||||
@ -172,42 +250,43 @@ well-known: static;
|
|||||||
###########################
|
###########################
|
||||||
##### BACKEND TARGETS #####
|
##### BACKEND TARGETS #####
|
||||||
|
|
||||||
.PHONY: %-backend
|
|
||||||
%-backend: FRADRIVE_SERVICE=backend
|
|
||||||
%-backend: --image-build --containerized---%-backend;
|
|
||||||
|
|
||||||
--start-backend:
|
ifeq ($(SERVICE_VARIANT), backend)
|
||||||
|
--start: --checkvarsset
|
||||||
DEV_PORT_HTTP=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTP=' | sed 's/DEV_PORT_HTTP=//'`; \
|
DEV_PORT_HTTP=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTP=' | sed 's/DEV_PORT_HTTP=//'`; \
|
||||||
DEV_PORT_HTTPS=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTPS=' | sed 's/DEV_PORT_HTTPS=//'`; \
|
DEV_PORT_HTTPS=`cat $(CONTAINER_FILE) | grep 'DEV_PORT_HTTPS=' | sed 's/DEV_PORT_HTTPS=//'`; \
|
||||||
stack --work-dir=.stack-work-run $(--DEVELOPMENT) exec -- yesod devel -p "$${DEV_PORT_HTTP}" -q "$${DEV_PORT_HTTPS}"
|
stack --work-dir=.stack-work-run $(--DEVELOPMENT) exec -- yesod devel -p "$${DEV_PORT_HTTP}" -q "$${DEV_PORT_HTTPS}"
|
||||||
--start-hoogle-backend:
|
endif
|
||||||
|
ifeq ($(SERVICE_VARIANT), hoogle)
|
||||||
|
--start:
|
||||||
HOOGLE_PORT=`cat $(CONTAINER_FILE) | grep 'HOOGLE_PORT=' | sed 's/HOOGLE_PORT=//'` ; \
|
HOOGLE_PORT=`cat $(CONTAINER_FILE) | grep 'HOOGLE_PORT=' | sed 's/HOOGLE_PORT=//'` ; \
|
||||||
echo "${HOOGLE_PORT}" ; \
|
echo "${HOOGLE_PORT}" ; \
|
||||||
stack --work-dir=.stack-work-doc hoogle -- server --local --port $${HOOGLE_PORT}
|
stack --work-dir=.stack-work-doc hoogle -- server --local --port $${HOOGLE_PORT}
|
||||||
|
endif
|
||||||
|
|
||||||
# HELP(compile-backend): compile backend
|
# HELP(compile-backend): compile backend
|
||||||
--compile-backend:
|
ifeq ($(SERVICE_VARIANT), backend)
|
||||||
|
--compile: --checkvarsset
|
||||||
stack build --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only $(--DEVELOPMENT) --local-bin-path $$(pwd)/bin
|
stack build --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only $(--DEVELOPMENT) --local-bin-path $$(pwd)/bin
|
||||||
|
|
||||||
# HELP(lint-backend): lint backend
|
# HELP(lint-backend): lint backend
|
||||||
--lint-backend:
|
--lint: --checkvarsset
|
||||||
stack build --test --fast --work-dir=.stack-work-test --flag uniworx:library-only $(--DEVELOPMENT) uniworx:test:hlint
|
stack build --test --fast --work-dir=.stack-work-test --flag uniworx:library-only $(--DEVELOPMENT) uniworx:test:hlint
|
||||||
|
|
||||||
# HELP(test-backend): test backend
|
# HELP(test-backend): test backend
|
||||||
--test-backend:
|
--test: --checkvarsset
|
||||||
stack build --test --coverage --fast --work-dir=.stack-work-test --flag uniworx:library-only $(--DEVELOPMENT)
|
stack build --test --coverage --fast --work-dir=.stack-work-test --flag uniworx:library-only $(--DEVELOPMENT)
|
||||||
|
endif
|
||||||
|
|
||||||
# TODO: better name
|
# HELP(uniworxdb): clear and fill database. requires running postgres
|
||||||
.PHONY: db
|
uniworxdb: --frontend-compile --backend-imagebuild-containerized-uniworxdb-start;
|
||||||
# HELP: clear and fill database. requires running postgres
|
|
||||||
db: FRADRIVE_SERVICE=backend
|
|
||||||
db: CONTAINER_NAME=uniworxdb
|
|
||||||
db: compile-frontend --image-build --containerized---db;
|
|
||||||
# TODO (db-m-$MIGRATION-backend): apply migration (see src/Model/Migration/Definition.hs for list of available migrations)
|
# TODO (db-m-$MIGRATION-backend): apply migration (see src/Model/Migration/Definition.hs for list of available migrations)
|
||||||
--db-backend: .stack --compile-backend
|
ifeq ($(SERVICE_VARIANT), uniworxdb)
|
||||||
|
--start: .stack
|
||||||
SERVER_SESSION_ACID_FALLBACK=${SERVER_SESSION_ACID_FALLBACK:-true} ; \
|
SERVER_SESSION_ACID_FALLBACK=${SERVER_SESSION_ACID_FALLBACK:-true} ; \
|
||||||
AVSPASS=${AVSPASS:-nopasswordset} ; \
|
AVSPASS=${AVSPASS:-nopasswordset} ; \
|
||||||
stack $(--DEVELOPMENT) exec uniworxdb -- $(UNIWORXDB_OPTS)
|
stack $(--DEVELOPMENT) exec uniworxdb -- $(UNIWORXDB_OPTS)
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: .stack
|
.PHONY: .stack
|
||||||
.stack:
|
.stack:
|
||||||
@ -226,13 +305,13 @@ db: compile-frontend --image-build --containerized---db;
|
|||||||
############################
|
############################
|
||||||
##### DATABASE TARGETS #####
|
##### DATABASE TARGETS #####
|
||||||
|
|
||||||
--containerized---db: CONTAINER_NAME=uniworxdb
|
ifeq ($(SERVICE_VARIANT), postgres)
|
||||||
--containerized---db: --containerized-db-backend;
|
--containerized-%: --checkvarsset docker/database/initdb.sh docker/database/pg_hba.conf docker/database/postgresql.conf docker/database/schema.sql --image-build
|
||||||
|
$(MAKE) -- --imagerun-$*
|
||||||
--containerized-%-database: FRADRIVE_SERVICE=database
|
else
|
||||||
--containerized-%-database: CONTAINER_NAME=database
|
--containerized-%: --checkvarsset
|
||||||
--containerized-%-database: docker/database/initdb.sh docker/database/pg_hba.conf docker/database/postgresql.conf docker/database/schema.sql --image-build
|
$(MAKE) -- --imagerun-$*
|
||||||
$(MAKE) -- --image-run-$*-database
|
endif
|
||||||
|
|
||||||
.PHONY: psql
|
.PHONY: psql
|
||||||
# HELP: enter psql (postgresql) cli inside a currently running database container
|
# HELP: enter psql (postgresql) cli inside a currently running database container
|
||||||
@ -247,38 +326,42 @@ psql: --database-shell;
|
|||||||
#############################
|
#############################
|
||||||
##### CONTAINER TARGETS #####
|
##### CONTAINER TARGETS #####
|
||||||
|
|
||||||
--containerized-%-frontend: FRADRIVE_SERVICE=frontend
|
#--containerized-%-frontend: FRADRIVE_SERVICE=frontend
|
||||||
--containerized-%-frontend: CONTAINER_NAME=frontend
|
#--containerized-%-frontend: SERVICE_VARIANT=frontend
|
||||||
--containerized-%-frontend: --image-build
|
#--containerized-%-frontend: --image-build
|
||||||
$(MAKE) -- --image-run-$*-frontend
|
# $(MAKE) -- --image-run-$*-frontend
|
||||||
|
#
|
||||||
--containerized-%-backend: FRADRIVE_SERVICE=backend
|
#--containerized-%-backend: FRADRIVE_SERVICE=backend
|
||||||
--containerized-%-backend: CONTAINER_NAME?=backend
|
#--containerized-%-backend: SERVICE_VARIANT?=backend
|
||||||
--containerized-%-backend: --image-build
|
#--containerized-%-backend: --image-build
|
||||||
$(MAKE) -- --image-run-$*-backend
|
# $(MAKE) -- --image-run-$*-backend
|
||||||
--containerized-%-hoogle: FRADRIVE_SERVICE=backend
|
#--containerized-%-hoogle: FRADRIVE_SERVICE=backend
|
||||||
--containerized-%-hoogle: CONTAINER_NAME=hoogle
|
#--containerized-%-hoogle: SERVICE_VARIANT=hoogle
|
||||||
--containerized-%-hoogle: --image-build
|
#--containerized-%-hoogle: --image-build
|
||||||
$(MAKE) -- --image-run-$*-hoogle-backend
|
# $(MAKE) -- --image-run-$*-hoogle-backend
|
||||||
|
|
||||||
# --containerized-%-minio: FRADRIVE_SERVICE=minio
|
# --containerized-%-minio: FRADRIVE_SERVICE=minio
|
||||||
# --containerized-%-minio: --image-build
|
# --containerized-%-minio: --image-build
|
||||||
# $(MAKE) -- --image-run-$*-minio
|
# $(MAKE) -- --image-run-$*-minio
|
||||||
--containerized---start-minio:
|
ifeq ($(SERVICE_VARIANT), minio)
|
||||||
|
--containerized-start:
|
||||||
UPLOAD_S3_PORT=`cat $(CONTAINER_FILE) | grep 'UPLOAD_S3_PORT=' | sed 's/UPLOAD_S3_PORT=//'`; \
|
UPLOAD_S3_PORT=`cat $(CONTAINER_FILE) | grep 'UPLOAD_S3_PORT=' | sed 's/UPLOAD_S3_PORT=//'`; \
|
||||||
MINIO_DIR=`mktemp` ; \
|
MINIO_DIR=`mktemp` ; \
|
||||||
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" "" "rm -rf $${MINIO_DIR}" & \
|
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" "" "rm -rf $${MINIO_DIR}" & \
|
||||||
CONTAINER_ID=`$(CONTAINER_BGRUN) --name fradrive.$(CURR_DEV).minio $(MINIO_IMAGE) -- server $${MINIO_DIR} --address=:$${UPLOAD_S3_PORT}` ; \
|
CONTAINER_ID=`$(CONTAINER_BGRUN) --name fradrive.$(CURR_DEV).minio $(MINIO_IMAGE) -- server $${MINIO_DIR} --address=:$${UPLOAD_S3_PORT}` ; \
|
||||||
printf "CONTAINER_ID=$${CONTAINER_ID}\nUPLOAD_S3_PORT=$${UPLOAD_S3_PORT}\nMINIO_DIR=$${MINIO_DIR}" >> $(CONTAINER_FILE)
|
printf "CONTAINER_ID=$${CONTAINER_ID}\nUPLOAD_S3_PORT=$${UPLOAD_S3_PORT}\nMINIO_DIR=$${MINIO_DIR}" >> $(CONTAINER_FILE)
|
||||||
|
endif
|
||||||
|
|
||||||
# --containerized-%-memcached: FRADRIVE_SERVICE=memcached
|
# --containerized-%-memcached: FRADRIVE_SERVICE=memcached
|
||||||
# --containerized-%-memcached: --image-build
|
# --containerized-%-memcached: --image-build
|
||||||
# $(MAKE) -- --image-run-$*-memcached
|
# $(MAKE) -- --image-run-$*-memcached
|
||||||
--containerized---start-memcached:
|
ifeq ($(SERVICE_VARIANT), memcached)
|
||||||
|
--containerized-start:
|
||||||
MEMCACHED_PORT=`cat $(CONTAINER_FILE) | grep 'MEMCACHED_PORT=' | sed 's/MEMCACHED_PORT=//'`; \
|
MEMCACHED_PORT=`cat $(CONTAINER_FILE) | grep 'MEMCACHED_PORT=' | sed 's/MEMCACHED_PORT=//'`; \
|
||||||
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" & \
|
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" & \
|
||||||
CONTAINER_ID=`$(CONTAINER_BGRUN) --name fradrive.$(CURR_DEV).memcached $(MEMCACHED_IMAGE) --port=$${MEMCACHED_PORT}` ; \
|
CONTAINER_ID=`$(CONTAINER_BGRUN) --name fradrive.$(CURR_DEV).memcached $(MEMCACHED_IMAGE) --port=$${MEMCACHED_PORT}` ; \
|
||||||
printf "CONTAINER_ID=$${CONTAINER_ID}\nMEMCACHED_PORT=$${MEMCACHED_PORT}" >> $(CONTAINER_FILE)
|
printf "CONTAINER_ID=$${CONTAINER_ID}\nMEMCACHED_PORT=$${MEMCACHED_PORT}" >> $(CONTAINER_FILE)
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: image-rebuild
|
.PHONY: image-rebuild
|
||||||
# HELP(image-rebuild-{backend,frontend,database,memcached,minio}): force-rebuild the stated docker image
|
# HELP(image-rebuild-{backend,frontend,database,memcached,minio}): force-rebuild the stated docker image
|
||||||
@ -296,42 +379,22 @@ image-rebuild-%:
|
|||||||
$(CONTAINER_COMMAND) build $(NO_CACHE) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --build-arg MOUNT_DIR=$${MOUNT_DIR} --build-arg PROJECT_DIR=$${PROJECT_DIR} --tag fradrive/$(FRADRIVE_SERVICE) --file $(PWD)/.Dockerfile ; \
|
$(CONTAINER_COMMAND) build $(NO_CACHE) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --build-arg MOUNT_DIR=$${MOUNT_DIR} --build-arg PROJECT_DIR=$${PROJECT_DIR} --tag fradrive/$(FRADRIVE_SERVICE) --file $(PWD)/.Dockerfile ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
--image-run-%: CONTAINER_NAME ?= $(FRADRIVE_SERVICE)
|
# runs --% in the container. Targets meant to be called manually cannot be run in the container via this target. If that is ever needed split this target into two targets, one for manually one for automatic (one may use the other) so that not at every usage a '---' has to be after containerized
|
||||||
--image-run-%: docker/$(FRADRIVE_SERVICE)/Dockerfile
|
--imagerun-%: --checkvarsset docker/$(FRADRIVE_SERVICE)/Dockerfile
|
||||||
MOUNT_DIR=/mnt/fradrive; \
|
MOUNT_DIR=/mnt/fradrive; \
|
||||||
if [ "$(IN_CONTAINER)" == "true" ] ; then \
|
if [ "$(IN_CONTAINER)" == "true" ] ; then \
|
||||||
$(MAKE) -- $* ; \
|
$(MAKE) -- $* ; \
|
||||||
else \
|
else \
|
||||||
if [ -z "$(CONTAINER_FILE)" ] ; then \
|
if [ -z "$(CONTAINER_FILE)" ] ; then \
|
||||||
$(CONTAINER_FGRUN) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* --env CONTAINER_FILE=$(CONTAINER_FILE) --env CONTAINER_FILE_CONTENT=$(CONTAINER_FILE_CONTENT) --env WATCH=$(WATCH) --name fradrive.$(CURR_DEV).$(CONTAINER_NAME) localhost/fradrive/$(FRADRIVE_SERVICE) ; \
|
$(CONTAINER_FGRUN) -v $(PWD):$${MOUNT_DIR} --env FRADRIVE_SERVICE=$(FRADRIVE_SERVICE) --env SERVICE_VARIANT=$(SERVICE_VARIANT) --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=--$* --env CONTAINER_FILE=$(CONTAINER_FILE) --env CONTAINER_FILE_CONTENT=$(CONTAINER_FILE_CONTENT) --env WATCH=$(WATCH) --name fradrive.$(CURR_DEV).$(SERVICE_VARIANT) localhost/fradrive/$(FRADRIVE_SERVICE) ; \
|
||||||
else \
|
else \
|
||||||
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" & \
|
./utils/watchcontainerrun.sh "$(CONTAINER_COMMAND)" "$(CONTAINER_FILE)" & \
|
||||||
CONTAINER_ID=`$(CONTAINER_BGRUN) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* --env CONTAINER_FILE=$(CONTAINER_FILE) --env CONTAINER_FILE_CONTENT=$(CONTAINER_FILE_CONTENT) --env WATCH=$(WATCH) --name fradrive.$(CURR_DEV).$(CONTAINER_NAME) localhost/fradrive/$(FRADRIVE_SERVICE)` ; \
|
CONTAINER_ID=`$(CONTAINER_BGRUN) -v $(PWD):$${MOUNT_DIR} --env FRADRIVE_SERVICE=$(FRADRIVE_SERVICE) --env SERVICE_VARIANT=$(SERVICE_VARIANT) --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=--$* --env CONTAINER_FILE=$(CONTAINER_FILE) --env CONTAINER_FILE_CONTENT=$(CONTAINER_FILE_CONTENT) --env WATCH=$(WATCH) --name fradrive.$(CURR_DEV).$(SERVICE_VARIANT) localhost/fradrive/$(FRADRIVE_SERVICE)` ; \
|
||||||
echo "CONTAINER_ID=$${CONTAINER_ID}" >> "$(CONTAINER_FILE)"; \
|
echo "CONTAINER_ID=$${CONTAINER_ID}" >> "$(CONTAINER_FILE)"; \
|
||||||
fi \
|
fi \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# TODO: move starts below to respective entries, or leave together?
|
|
||||||
|
|
||||||
start-database: BASE_PORTS = "PGPORT=5432"
|
|
||||||
start-database: SINGLETON = true
|
|
||||||
|
|
||||||
start-memcached: BASE_PORTS = "MEMCACHED_PORT=11211"
|
|
||||||
start-memcached: SINGLETON = true
|
|
||||||
|
|
||||||
start-minio: BASE_PORTS = "UPLOAD_S3_PORT=9000"
|
|
||||||
start-minio: SINGLETON = true
|
|
||||||
|
|
||||||
start-backend: BASE_PORTS = "DEV_PORT_HTTP=3000" "DEV_PORT_HTTPS=3443"
|
|
||||||
start-backend: SINGLETON = false
|
|
||||||
start-backend: compile-frontend
|
|
||||||
|
|
||||||
start-hoogle: BASE_PORTS = "HOOGLE_PORT=8081"
|
|
||||||
start-hoogle: SINGLETON = true
|
|
||||||
|
|
||||||
start-frontend: SINGLETON = false
|
|
||||||
start-frontend: WATCH = false
|
|
||||||
|
|
||||||
# HELP(start-database): start postgres server
|
# HELP(start-database): start postgres server
|
||||||
# HELP(start-memcached): start memcached server
|
# HELP(start-memcached): start memcached server
|
||||||
|
|||||||
Reference in New Issue
Block a user