build(Makefile): work on start targets

This commit is contained in:
Sarah Vaupel 2024-09-06 05:59:44 +02:00
parent faf4cc8c03
commit 277ae187f5
3 changed files with 19 additions and 16 deletions

View File

@ -41,6 +41,9 @@ release:
############################################
##### UNIFIED FRONTEND/BACKEND TARGETS #####
.PHONY: serve
serve: serve-frontend serve-backend
.PHONY: compile
compile: compile-frontend compile-backend
@ -68,9 +71,9 @@ test: test-frontend test-backend i18n-check
--compile-frontend:
npx -- webpack --progress $(WATCH)
.PHONY: --frontend-watch
--frontend-watch: WATCH=--watch
--frontend-watch: --compile-frontend;
.PHONY: --serve-frontend
--serve-frontend: WATCH=--watch
--serve-frontend: --compile-frontend;
.PHONY: --lint-frontend
--lint-frontend: eslint.config.js
@ -82,6 +85,7 @@ test: test-frontend test-backend i18n-check
@echo Karma frontend tests are currently broken after npm update and have therefor been temporarily disabled.
# npx -- karma start --conf karma.conf.cjs $(WATCH)
# TODO: rewrite
.PHONY: --test-frontend-watch
--test-frontend-watch: WATCH=--single-run false
--test-frontend-watch: --test-frontend;
@ -136,11 +140,15 @@ well-known/.well-known:
--%-backend-dev: stackopts=--flag uniworx:dev
--%-backend-dev: --image-build --%-backend;
.PHONY: --backend-%-prod
.PHONY: --%-backend-prod
--%-backend-prod: FRADRIVE_SERVICE=backend
--%-backend-prod: stackopts=--flag uniworx:-dev
--%-backend-prod: --image-build --%-backend;
.PHONY: --serve-backend
--serve-backend: .stack-work.lock
./start.sh
.PHONY: --compile-backend
--compile-backend:
stack build --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only --copy-bins --local-bin-path $$(pwd)/bin $(stackopts)

View File

@ -21,4 +21,7 @@ ENV STACK_ROOT=/.stack
RUN make .stack STACK_ROOT=${STACK_ROOT} IN_CONTAINER=true
ENV FRADRIVE_MAKE_TARGET=backend-build
ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT=${STACK_ROOT} IN_CONTAINER=true
ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT=${STACK_ROOT} IN_CONTAINER=true
# export full develop port range
EXPOSE TODO/tcp

View File

@ -2,18 +2,11 @@
set -e
# SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>, Sarah Vaupel <vaupel.sarah@campus.lmu.de>, Steffen Jost <jost@tcs.ifi.lmu.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en .stack-work.lock "$0" "$@" || :
if ! in-develop | grep -q 'In develop'; then
printf "Not in develop"
exit 1
fi
__HOST=${HOST:-$(hostname -s | awk '{ print $0; }')}
export DETAILED_LOGGING=${DETAILED_LOGGING:-true}
@ -28,11 +21,10 @@ export ENCRYPT_ERRORS=${ENCRYPT_ERRORS:-false}
export RIBBON=${RIBBON:-${__HOST:-localhost}}
export APPROOT=${APPROOT:-http://localhost:$((${PORT_OFFSET:-0} + 3000))}
export AVSPASS=${AVSPASS:-nopasswordset}
export PATH=${PATH:/home/jost/projects/fradrive}
export MAIL_REROUTE_TO_NAME='Steffen Jost'
export MAIL_REROUTE_TO_EMAIL=jost@tcs.ifi.lmu.de
unset HOST
export PORT_OFFSET=$(((16#$(sha256sum <<<"$(hostname -f):''${basePath}" | head -c 16)) % 1000))
move-back() {
mv -vT .stack-work .stack-work-run
[[ -d .stack-work-build ]] && mv -vT .stack-work-build .stack-work