Skip to content

Commit 0de9cc3

Browse files
Merge pull request #7 from mageops/dev-update-deps
Update dependencies, replace phat builder
2 parents 8f4fc7f + b6a0529 commit 0de9cc3

File tree

5 files changed

+458
-831
lines changed

5 files changed

+458
-831
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor/
22
!/build/.gitkeep
3-
/build/*
3+
/build/*
4+
/bin/version

build.dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ FROM composer:2
44
# Install the BCMath extension
55
RUN docker-php-ext-install bcmath
66

7+
# Configure git to trust any directory
8+
RUN git config --global --add safe.directory '*'
9+
710
# build with: docker build -t aws-execfwd-build -f build.dockerfile .
811
# Execute with: docker run --rm -it -e COMPOSER_PROCESS_TIMEOUT=0 -w $PWD -v $PWD:$PWD aws-execfwd-build build

build.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ set -euo pipefail
33
DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
44
cd "$DIR"
55

6+
# Build the Docker image
67
docker build -t aws-execfwd-build -f build.dockerfile .
7-
docker run --rm -it -e COMPOSER_PROCESS_TIMEOUT=0 -w $PWD -v $PWD:$PWD aws-execfwd-build install
8-
docker run --rm -it -e COMPOSER_PROCESS_TIMEOUT=0 -w $PWD -v $PWD:$PWD aws-execfwd-build build
8+
9+
# Create a container with long sleep to keep it alive
10+
CONTAINER=$(docker create aws-execfwd-build sleep 7200)
11+
docker cp . $CONTAINER:/app/
12+
13+
# Start container and run commands
14+
docker start $CONTAINER
15+
docker exec $CONTAINER composer install --working-dir=/app
16+
docker exec $CONTAINER composer build --working-dir=/app
17+
18+
# Copy the build artifact back
19+
mkdir -p build
20+
docker cp $CONTAINER:/app/build/aws-excfwd ./build/
21+
22+
# Clean up
23+
docker rm -f $CONTAINER

composer.json

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,21 @@
2323
"require": {
2424
"php": "^7 || ^8",
2525
"aws/aws-sdk-php": "^3.36",
26-
"symfony/console": "^4",
27-
"psr/log": "^3"
26+
"symfony/console": "^6.4",
27+
"psr/log": "^1"
2828
},
2929
"require-dev": {
30-
"macfja/phar-builder": "^0.2.8"
30+
"clue/phar-composer": "^1.4"
3131
},
32+
"bin": [
33+
"bin/cli.php"
34+
],
3235
"scripts": {
33-
"build": "php -d phar.readonly=0 vendor/bin/phar-builder package composer.json"
34-
},
35-
"extra": {
36-
"phar-builder": {
37-
"compression": "GZip",
38-
"name": "aws-excfwd.phar",
39-
"output-dir": "build",
40-
"entry-point": "./bin/cli.php",
41-
"include": ["bin"],
42-
"include-dev": false,
43-
"skip-shebang": false,
44-
"events": {
45-
"command.package.start" : "git rev-parse --short HEAD > bin/version",
46-
"command.package.end": [
47-
"rm bin/version",
48-
"chmod +x build/aws-excfwd.phar",
49-
"mv build/aws-excfwd.phar build/aws-excfwd"
50-
]
51-
}
52-
}
36+
"build": [
37+
"git rev-parse --short HEAD > bin/version",
38+
"php -d phar.readonly=0 vendor/bin/phar-composer build . build/aws-excfwd",
39+
"rm bin/version",
40+
"chmod +x build/aws-excfwd"
41+
]
5342
}
5443
}

0 commit comments

Comments
 (0)