Merge remote-tracking branch 'origin/145-build-system-rewrite' into 144-ghc-update
This commit is contained in:
commit
f35f058479
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,6 +13,9 @@ cabal-dev/
|
||||
.cache/
|
||||
.stack/
|
||||
.stack-work/
|
||||
.dev-port-http
|
||||
.dev-port-https
|
||||
.bash_history
|
||||
yesod-devel/
|
||||
.cabal-sandbox
|
||||
cabal.sandbox.config
|
||||
|
||||
85
Makefile
85
Makefile
@ -65,15 +65,13 @@ test: test-frontend test-backend i18n-check
|
||||
|
||||
.PHONY: %-frontend
|
||||
%-frontend: FRADRIVE_SERVICE=frontend
|
||||
%-frontend: --image-build --containerized-%-frontend;
|
||||
%-frontend: --image-build --containerized---%-frontend;
|
||||
|
||||
.PHONY: --%-frontend
|
||||
#--%-frontend: node_modules well-known;
|
||||
#--%-frontend: --containerized---node_modules-frontend --containerized---well-known-frontend;
|
||||
--%-frontend: --containerized---frontend-dependencies-frontend;
|
||||
|
||||
.PHONY: --compile-frontend
|
||||
--compile-frontend:
|
||||
--compile-frontend: --frontend-dependencies
|
||||
npx -- webpack --progress $(WATCH)
|
||||
|
||||
.PHONY: --serve-frontend
|
||||
@ -90,53 +88,24 @@ 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;
|
||||
#
|
||||
#node_modules: package.json package-lock.json
|
||||
# $(MAKE) -- --containerized---node_modules-frontend
|
||||
#.PHONY: --node_modules
|
||||
#--node_modules: package.json package-lock.json
|
||||
# npm ci --cache .npm --prefer-offline
|
||||
#
|
||||
#package-lock.json: package.json
|
||||
# $(MAKE) -- --image-run---package-lock.json
|
||||
#.PHONY: --package-lock.json
|
||||
#--package-lock.json: package.json
|
||||
# npm install --cache .npm --prefer-offline
|
||||
#
|
||||
#assets: node_modules
|
||||
# $(MAKE) -- --image-run---assets
|
||||
#.PHONY: --assets/icons
|
||||
#--assets: node_modules
|
||||
# ./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/solid utils/rename-fa.json assets/icons/fradrive
|
||||
# ./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/regular utils/rename-fa.json assets/icons/fradrive
|
||||
#
|
||||
#well-known: node_modules assets well-known/.well-known
|
||||
# $(MAKE) -- --containerized---well-known-frontend
|
||||
#.PHONY: --well-known
|
||||
#--well-known: --node_modules assets well-known/.well-known
|
||||
# npx webpack --progress
|
||||
## mark well-known directory as clean after successful webpack run:
|
||||
# touch well-known/.well-known
|
||||
|
||||
.PHONY: --frontend-dependencies
|
||||
--frontend-dependencies: node_modules package.json package-lock.json assets
|
||||
--frontend-dependencies: node_modules package.json package-lock.json assets;
|
||||
|
||||
node_modules: package.json package-lock.json
|
||||
npm ci --cache .npm --prefer-offline
|
||||
|
||||
package-lock.json: package.json
|
||||
npm install --cache .npm --prefer-offline
|
||||
|
||||
assets: node_modules
|
||||
./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/solid utils/rename-fa.json assets/icons/fradrive
|
||||
./utils/renamer.pl node_modules/@fortawesome/fontawesome-free/svgs/regular utils/rename-fa.json assets/icons/fradrive
|
||||
assets/.assets:
|
||||
# no-op target
|
||||
|
||||
well-known: node_modules assets well-known/.well-known
|
||||
npx webpack --progress
|
||||
touch well-known/.well-known
|
||||
|
||||
|
||||
well-known/.well-known:
|
||||
# no-op target
|
||||
|
||||
@ -149,16 +118,16 @@ well-known/.well-known:
|
||||
|
||||
.PHONY: %-backend
|
||||
%-backend: FRADRIVE_SERVICE=backend
|
||||
%-backend: --image-build --containerized-%-dev-backend;
|
||||
%-backend: --image-build --containerized---%-dev-backend;
|
||||
|
||||
.PHONY: %-prod-backend
|
||||
%-prod-backend: FRADRIVE_SERVICE=backend
|
||||
%-prod-backend: --image-build --containerized-%-prod-backend;
|
||||
%-prod-backend: --image-build --containerized---%-prod-backend;
|
||||
|
||||
.PHONY: --%-dev-backend
|
||||
--%-dev-backend: FRADRIVE_SERVICE=backend
|
||||
--%-dev-backend: stackopts=--flag uniworx:dev
|
||||
--%-dev-backend: --image-build --containerized-%-backend;
|
||||
--%-dev-backend: --image-build --containerized---%-backend;
|
||||
|
||||
.PHONY: --%-prod-backend
|
||||
--%-prod-backend: FRADRIVE_SERVICE=backend
|
||||
@ -167,17 +136,18 @@ well-known/.well-known:
|
||||
|
||||
.PHONY: serve-backend
|
||||
serve-backend:
|
||||
export DEV_PORT_HTTP=`netstat -tulan | perl -le 'use strict;use warnings;my %p=();my $addr=qr((?:\d+.\d+.\d+.\d+|[0-9a-f:]+));while(<>){ if(m#$addr:(\d+)\s+$addr:(?:\d+|\*)\s+#) { $p{$1}=1 }}; my $port = 3000; $port++ while $p{$port}; print $port'` ; \
|
||||
export DEV_PORT_HTTPS=`netstat -tulan | perl -le 'use strict;use warnings;my %p=();my $addr=qr((?:\d+.\d+.\d+.\d+|[0-9a-f:]+));while(<>){ if(m#$addr:(\d+)\s+$addr:(?:\d+|\*)\s+#) { $p{$1}=1 }}; my $port = 3443; $port++ while $p{$port}; print $port'` ; \
|
||||
echo "bisschen mehr: ${DEV_PORT_HTTP}" ; \
|
||||
$(MAKE) -- --containerized---serve-dev-backend DEV_PORT_HTTP=${DEV_PORT_HTTP} DEV_PORT_HTTPS=${DEV_PORT_HTTPS}
|
||||
DEV_PORT_HTTP=`docker/backend/dev_port.pl 3000 | tee .dev-port-http` \
|
||||
DEV_PORT_HTTPS=`docker/backend/dev_port.pl 3443 | tee .dev-port-https` \
|
||||
$(MAKE) -- --containerized---serve-dev-backend DEV_PORT_HTTP=$${DEV_PORT_HTTP} DEV_PORT_HTTPS=$${DEV_PORT_HTTPS}
|
||||
.PHONY: --serve-dev-backend
|
||||
--serve-dev-backend:
|
||||
--serve-dev-backend: start.sh
|
||||
DEV_PORT_HTTP=`cat .dev-port-http` \
|
||||
DEV_PORT_HTTPS=`cat .dev-port-https` \
|
||||
./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)
|
||||
stack build --fast --profile --library-profiling --executable-profiling --flag uniworx:-library-only --local-bin-path $$(pwd)/bin $(stackopts)
|
||||
|
||||
.PHONY: --lint-backend
|
||||
--lint-backend:
|
||||
@ -225,17 +195,13 @@ serve-database: --containerized-database
|
||||
--containerized-%-frontend: FRADRIVE_SERVICE=frontend
|
||||
#--containerized-%-frontend: --image-build --image-run-%-frontend;
|
||||
--containerized-%-frontend: --image-build
|
||||
if [ "$(IN_CONTAINER)" == "false" ] ; then \
|
||||
$(MAKE) -- --image-run-$*-frontend ; \
|
||||
fi
|
||||
$(MAKE) -- --image-run-$*-frontend
|
||||
|
||||
.PHONY: --containerized-%-backend
|
||||
--containerized-%-backend: FRADRIVE_SERVICE=backend
|
||||
#--containerized-%-backend: --image-build --image-run-%-backend;
|
||||
--containerized-%-backend: --image-build
|
||||
if [ "$(IN_CONTAINER)" == "false" ] ; then \
|
||||
$(MAKE) -- --image-run-$*-backend ; \
|
||||
fi
|
||||
$(MAKE) -- --image-run-$*-backend
|
||||
|
||||
.PHONY: image-rebuild
|
||||
image-rebuild-%:
|
||||
@ -255,11 +221,12 @@ image-rebuild-%:
|
||||
|
||||
.PHONY: --image-run-%
|
||||
--image-run-%:
|
||||
ifeq ($(IN_CONTAINER),true)
|
||||
$(MAKE) -- $*
|
||||
else
|
||||
$(CONTAINER_COMMAND) run -v $(PWD):/mnt/fradrive --env FRADRIVE_MAKE_TARGET=$* fradrive/$(FRADRIVE_SERVICE)
|
||||
endif
|
||||
MOUNT_DIR=/mnt/fradrive; \
|
||||
if [ "$(IN_CONTAINER)" == "true" ] ; then \
|
||||
$(MAKE) -- $* ; \
|
||||
else \
|
||||
$(CONTAINER_COMMAND) run -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* fradrive/$(FRADRIVE_SERVICE) ; \
|
||||
fi
|
||||
|
||||
##### CONTAINER TARGETS #####
|
||||
#############################
|
||||
|
||||
@ -24,6 +24,5 @@ RUN stack build yesod-bin
|
||||
ENV FRADRIVE_MAKE_TARGET=serve-backend
|
||||
ENTRYPOINT make -- ${FRADRIVE_MAKE_TARGET} STACK_ROOT=${STACK_ROOT} IN_CONTAINER=true
|
||||
|
||||
# export full develop port range
|
||||
ENV DEV_PORT=3000
|
||||
EXPOSE ${DEV_PORT}/tcp
|
||||
EXPOSE 3000/tcp
|
||||
EXPOSE 3443/tcp
|
||||
19
docker/backend/dev_port.pl
Executable file
19
docker/backend/dev_port.pl
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $port = $ARGV[0];
|
||||
my $used_ports = `netstat -tulan`;
|
||||
|
||||
my %p=();
|
||||
my $addr=qr((?:\d+.\d+.\d+.\d+|[0-9a-f:]+));
|
||||
for(split m/\R/, $used_ports) {
|
||||
if(m#$addr:(\d+)\s+$addr:(?:\d+|\*)\s+#) {
|
||||
$p{$1}=1;
|
||||
}
|
||||
};
|
||||
|
||||
$port++ while $p{$port};
|
||||
|
||||
print $port
|
||||
@ -1 +0,0 @@
|
||||
netstat -tulan | perl -le 'use strict;use warnings;my %p=();my $addr=qr((?:\d+.\d+.\d+.\d+|[0-9a-f:]+));while(<>){ if(m#$addr:(\d+)\s+$addr:(?:\d+|*)\s+#) { $p{$1}=1 }}; my $port = 3000; $port++ while $p{$port}; print $port'
|
||||
2
start.sh
2
start.sh
@ -41,7 +41,7 @@ then
|
||||
yesod devel -p "$DEV_PORT_HTTP" -q "$DEV_PORT_HTTPS" $@
|
||||
elif ! [ -z "$(which stack)" ]
|
||||
then
|
||||
stack exec -- yesod devel -p "$DEV_PORT_HTTP" -q "$DEV_PORT_HTTPS" $@ --copy-bins --local-bin-path $(pwd)/bin
|
||||
stack exec -- yesod devel -p "$DEV_PORT_HTTP" -q "$DEV_PORT_HTTPS" $@
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user