Skip to content
Snippets Groups Projects
Commit 9f748873 authored by jurgenhaas's avatar jurgenhaas
Browse files

#2 Remove redundant code and optimize the project code generally

parent d4fc9c2e
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
docker-compose exec ${LAKEDROPS_DEV_DC_OPTIONS} --user root php drush $@
#!/bin/bash
./node_modules/gulp/bin/gulp.js
#!/bin/sh
set -eu
# "modprobe" without modprobe
# https://twitter.com/lucabruno/status/902934379835662336
# this isn't 100% fool-proof, but it'll have a much higher success rate than simply using the "real" modprobe
# Docker often uses "modprobe -va foo bar baz"
# so we ignore modules that start with "-"
for module; do
if [ "${module#-}" = "$module" ]; then
ip link show "$module" || true
lsmod | grep "$module" || true
fi
done
# remove /usr/local/... from PATH so we can exec the real modprobe as a last resort
export PATH='/usr/sbin:/usr/bin:/sbin:/bin'
exec modprobe "$@"
#!/bin/bash
docker run -t -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim node $@
#!/bin/bash
docker run -t -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim npm $@
<?php
function readContainerConfig() {
try {
$output = [];
exec('basename "$(cat /proc/1/cpuset)"', $output);
$id = reset($output);
$output = [];
exec('docker container inspect ' . $id, $output);
return json_decode(implode('', $output), TRUE)[0];
}
catch (\Exception $ex) {
// Ignore.
}
return [];
}
function getDockerMountSource() {
$currentDir = getcwd();
$container = readContainerConfig();
foreach ($container['Mounts'] as $mount) {
if (strpos($currentDir, $mount['Destination']) === 0) {
return $mount['Source'] . ':' . $mount['Destination'];
}
}
return $currentDir . ':' . $currentDir;
}
print(getDockerMountSource());
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment