Skip to content

Commit d7ead12

Browse files
committed
feat(docker): archive job
1 parent a172056 commit d7ead12

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

.docker/application.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ backend(){
3636
exec bash loop-validate.sh
3737
}
3838

39+
archive(){
40+
exec bash archive.sh
41+
}
42+
3943
test(){
4044
export APP_ENV=test
4145
export DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database:5432/validator_api_test?serverVersion=15&charset=utf8"

archive.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4+
5+
RUNNING=1
6+
7+
_term(){
8+
echo "$BASH_SOURCE - caught signal, terminating..."
9+
RUNNING=0
10+
kill -s SIGTERM $child_pid
11+
wait
12+
}
13+
14+
15+
# Note that trapping SIGWINCH is due to weird usage of this "window resized" by apache2
16+
# (see https://bz.apache.org/bugzilla/show_bug.cgi?id=50669)
17+
# ...propagated to STOPSIGNAL=SIGWINCH in php:8.2-apache docker image
18+
# ...which leads to an unexpected behavior of "docker stop"
19+
# ...and probably problems with PHP applications including console commands (Symfony, Laravel,...)
20+
trap _term SIGTERM SIGINT SIGWINCH
21+
22+
echo "$BASH_SOURCE - started with PID=$$"
23+
24+
if [ $RUNNING -eq 1 ]
25+
do
26+
php "${SCRIPT_DIR}/bin/console" ign-validator:validations:cleanup -vvv &
27+
child_pid=$!
28+
wait $child_pid
29+
done
30+
31+
echo "$BASH_SOURCE - ended"

0 commit comments

Comments
 (0)