build(Makefile): work on make serve
This commit is contained in:
parent
6709d27732
commit
1f0cd1066a
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,6 +13,9 @@ cabal-dev/
|
|||||||
.cache/
|
.cache/
|
||||||
.stack/
|
.stack/
|
||||||
.stack-work/
|
.stack-work/
|
||||||
|
.dev-port-http
|
||||||
|
.dev-port-https
|
||||||
|
.bash_history
|
||||||
yesod-devel/
|
yesod-devel/
|
||||||
.cabal-sandbox
|
.cabal-sandbox
|
||||||
cabal.sandbox.config
|
cabal.sandbox.config
|
||||||
|
|||||||
13
Makefile
13
Makefile
@ -167,17 +167,18 @@ well-known/.well-known:
|
|||||||
|
|
||||||
.PHONY: serve-backend
|
.PHONY: serve-backend
|
||||||
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'` ; \
|
DEV_PORT_HTTP=`docker/backend/dev_port.pl 3000 | tee .dev-port-http` \
|
||||||
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'` ; \
|
DEV_PORT_HTTPS=`docker/backend/dev_port.pl 3443 | tee .dev-port-https` \
|
||||||
echo "bisschen mehr: ${DEV_PORT_HTTP}" ; \
|
$(MAKE) -- --containerized---serve-dev-backend DEV_PORT_HTTP=$${DEV_PORT_HTTP} DEV_PORT_HTTPS=$${DEV_PORT_HTTPS}
|
||||||
$(MAKE) -- --containerized---serve-dev-backend DEV_PORT_HTTP=${DEV_PORT_HTTP} DEV_PORT_HTTPS=${DEV_PORT_HTTPS}
|
|
||||||
.PHONY: --serve-dev-backend
|
.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
|
./start.sh
|
||||||
|
|
||||||
.PHONY: --compile-backend
|
.PHONY: --compile-backend
|
||||||
--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
|
.PHONY: --lint-backend
|
||||||
--lint-backend:
|
--lint-backend:
|
||||||
|
|||||||
@ -24,6 +24,5 @@ RUN stack build yesod-bin
|
|||||||
ENV FRADRIVE_MAKE_TARGET=serve-backend
|
ENV FRADRIVE_MAKE_TARGET=serve-backend
|
||||||
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 3000/tcp
|
||||||
ENV DEV_PORT=3000
|
EXPOSE 3443/tcp
|
||||||
EXPOSE ${DEV_PORT}/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" $@
|
yesod devel -p "$DEV_PORT_HTTP" -q "$DEV_PORT_HTTPS" $@
|
||||||
elif ! [ -z "$(which stack)" ]
|
elif ! [ -z "$(which stack)" ]
|
||||||
then
|
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
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user