refactor: move into a website directory
This commit is contained in:
parent
86529d7148
commit
3c5c0e808a
747 changed files with 133 additions and 2 deletions
103
run
103
run
|
@ -1,103 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
TTY=""
|
||||
if [[ ! -t 1 ]]; then
|
||||
TTY="-T"
|
||||
fi
|
||||
|
||||
DC="${DC:-exec}"
|
||||
|
||||
function ci:build-images {
|
||||
docker build --target production -t ghcr.io/opdavies/oliverdavies.uk-build:latest .
|
||||
docker build --target production -t ghcr.io/opdavies/oliverdavies.uk-build:$(git rev-parse HEAD) .
|
||||
}
|
||||
|
||||
function ci:push-images {
|
||||
docker push ghcr.io/opdavies/oliverdavies.uk-build:latest
|
||||
docker push ghcr.io/opdavies/oliverdavies.uk-build:$(git rev-parse HEAD)
|
||||
}
|
||||
|
||||
function cmd {
|
||||
# Run any command in the app container.
|
||||
_dc app "${@}"
|
||||
}
|
||||
|
||||
function composer {
|
||||
DC=run
|
||||
_dc --entrypoint composer app "${@}"
|
||||
}
|
||||
|
||||
function deploy {
|
||||
cd tools/deployment
|
||||
ansible-playbook deploy.yml "${@}"
|
||||
}
|
||||
|
||||
function help {
|
||||
printf "%s <task> [args]\n\nTasks:\n" "${0}"
|
||||
|
||||
compgen -A function | grep -v "^_" | cat -n
|
||||
|
||||
printf "\nExtended help:\n Each task has comments for general usage\n"
|
||||
}
|
||||
|
||||
function run-production {
|
||||
DESTINATION_PATH="${2:-/var/www/oliverdavies.uk}"
|
||||
GIT_COMMIT_HASH="${1:-latest}"
|
||||
|
||||
# Clean up any old containers or files within the artifact directory.
|
||||
rm -fr ${DESTINATION_PATH}/* || true
|
||||
|
||||
docker image pull ghcr.io/opdavies/oliverdavies-uk-web:${GIT_COMMIT_HASH}
|
||||
|
||||
docker container run \
|
||||
--entrypoint sh \
|
||||
--name oliverdavies-uk-web \
|
||||
ghcr.io/opdavies/oliverdavies-uk-web:${GIT_COMMIT_HASH}
|
||||
|
||||
docker container cp oliverdavies-uk-web:/code/. ${DESTINATION_PATH}
|
||||
|
||||
docker container rm oliverdavies-uk-web
|
||||
}
|
||||
|
||||
function sh {
|
||||
DC=run
|
||||
_dc --entrypoint sh app
|
||||
}
|
||||
|
||||
function test:quality {
|
||||
DC=run
|
||||
_dc --entrypoint phpstan app "${@}" analyze --memory-limit=-1
|
||||
}
|
||||
|
||||
function test:unit {
|
||||
DC=run
|
||||
_dc --entrypoint phpunit app "${@}"
|
||||
}
|
||||
|
||||
function yarn:build:css {
|
||||
# Build CSS assets, this is meant to be run from within the assets container.
|
||||
local args=()
|
||||
|
||||
if [ "${SCULPIN_ENV}" == "prod" ]; then
|
||||
args=(--minify)
|
||||
elif [ "${NODE_ENV}" == "development" ]; then
|
||||
args=(--watch)
|
||||
fi
|
||||
|
||||
tailwindcss --postcss \
|
||||
-i assets/css/tailwind.pcss \
|
||||
-o source/build/app.css "${args[@]}"
|
||||
}
|
||||
|
||||
function yarn:build:js {
|
||||
# Build JS assets, this is meant to be run from within the assets container.
|
||||
node esbuild.config.js
|
||||
}
|
||||
|
||||
function _dc {
|
||||
docker-compose ${DC} ${TTY} "${@}"
|
||||
}
|
||||
|
||||
eval "${@:-help}"
|
Loading…
Add table
Add a link
Reference in a new issue