Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
!/build/.gitkeep
/build/*
/build/*
/bin/version
3 changes: 3 additions & 0 deletions build.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ FROM composer:2
# Install the BCMath extension
RUN docker-php-ext-install bcmath

# Configure git to trust any directory
RUN git config --global --add safe.directory '*'

# build with: docker build -t aws-execfwd-build -f build.dockerfile .
# Execute with: docker run --rm -it -e COMPOSER_PROCESS_TIMEOUT=0 -w $PWD -v $PWD:$PWD aws-execfwd-build build
19 changes: 17 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ set -euo pipefail
DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
cd "$DIR"

# Build the Docker image
docker build -t aws-execfwd-build -f build.dockerfile .
docker run --rm -it -e COMPOSER_PROCESS_TIMEOUT=0 -w $PWD -v $PWD:$PWD aws-execfwd-build install
docker run --rm -it -e COMPOSER_PROCESS_TIMEOUT=0 -w $PWD -v $PWD:$PWD aws-execfwd-build build

# Create a container with long sleep to keep it alive
CONTAINER=$(docker create aws-execfwd-build sleep 7200)
docker cp . $CONTAINER:/app/

# Start container and run commands
docker start $CONTAINER
docker exec $CONTAINER composer install --working-dir=/app
docker exec $CONTAINER composer build --working-dir=/app

# Copy the build artifact back
mkdir -p build
docker cp $CONTAINER:/app/build/aws-excfwd ./build/

# Clean up
docker rm -f $CONTAINER
35 changes: 12 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,21 @@
"require": {
"php": "^7 || ^8",
"aws/aws-sdk-php": "^3.36",
"symfony/console": "^4",
"psr/log": "^3"
"symfony/console": "^6.4",
"psr/log": "^1"
},
"require-dev": {
"macfja/phar-builder": "^0.2.8"
"clue/phar-composer": "^1.4"
},
"bin": [
"bin/cli.php"
],
"scripts": {
"build": "php -d phar.readonly=0 vendor/bin/phar-builder package composer.json"
},
"extra": {
"phar-builder": {
"compression": "GZip",
"name": "aws-excfwd.phar",
"output-dir": "build",
"entry-point": "./bin/cli.php",
"include": ["bin"],
"include-dev": false,
"skip-shebang": false,
"events": {
"command.package.start" : "git rev-parse --short HEAD > bin/version",
"command.package.end": [
"rm bin/version",
"chmod +x build/aws-excfwd.phar",
"mv build/aws-excfwd.phar build/aws-excfwd"
]
}
}
"build": [
"git rev-parse --short HEAD > bin/version",
"php -d phar.readonly=0 vendor/bin/phar-composer build . build/aws-excfwd",
"rm bin/version",
"chmod +x build/aws-excfwd"
]
}
}
Loading