Last active
August 16, 2023 12:34
-
-
Save geerlingguy/85b816ed7aff378ea2700b82ebde81c8 to your computer and use it in GitHub Desktop.
BLT Artifactory - Build BLT deployment artifacts with Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# BLT Deployment Artifact generator using a local Docker image. | |
# | |
# Source: https://gist.github.com/geerlingguy/85b816ed7aff378ea2700b82ebde81c8 | |
# | |
# This script should be run from within the BLT project directory root. If it is | |
# run elsewhere, the project_dir should be updated accordingly. | |
name="blt-artifactory" | |
project_dir="." | |
# Remove any existing "deploy/" directory. | |
printf "Removing any previously-existing deployment artifacts.\n" | |
rm -rf $project_dir/deploy/ | |
# Start the build container. | |
printf "Starting the build container.\n" | |
docker run -d --name $name -v `pwd`/$project_dir:/blt php:7.2-cli-stretch tail -f /dev/null | |
# Install dependencies. | |
docker exec $name bash -c "apt-get update && apt-get install -y gnupg unzip git libpng-dev libbz2-dev" | |
docker exec $name bash -c "docker-php-ext-install gd \ | |
&& docker-php-ext-install bz2" | |
# Install Node.js 8.x. | |
docker exec $name bash -c "curl -sL https://deb.nodesource.com/setup_8.x | bash -" | |
docker exec $name bash -c "apt-get install -y nodejs" | |
# Install Composer. | |
docker exec $name bash -c "php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\" \ | |
&& php composer-setup.php \ | |
&& mv composer.phar /usr/local/bin/composer" | |
# Install dependencies and BLT alias. | |
docker exec $name bash -c "cd /blt && composer install" | |
# Generate the deployment artifact. | |
printf "Generating the deployment artifact.\n" | |
docker exec $name bash -c "cd /blt && vendor/bin/blt artifact:build" | |
# Destroy the build container. | |
docker rm -f $name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment