neko/.m1k1o/build
2021-03-29 22:09:09 +01:00

48 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
cd "$(dirname "$0")"
BASE="${PWD}/../"
IMAGE="m1k1o/neko"
build_client() {
docker build -t neko-dev-client -f base/Dockerfile --target client "${BASE}"
docker run --rm \
--user "$(id -u):$(id -g)" \
-v "${BASE}client/dist:/tmp/dist" \
neko-dev-client sh -c "rm -rf /tmp/dist/*; cp -r /src/dist/* /tmp/dist"
}
build_server() {
docker build -t neko-dev-server -f base/Dockerfile --target server "${BASE}"
docker run --rm \
--user "$(id -u):$(id -g)" \
-v "${BASE}server/bin:/tmp/bin" \
neko-dev-server sh -c "rm -rf /tmp/bin/neko; cp /src/bin/neko /tmp/bin"
}
build_base() {
docker build -t "${IMAGE}:base" -f base/Dockerfile "${BASE}"
}
build_base_arm() {
docker build -t "${IMAGE}:base_arm" -f base_arm/Dockerfile "${BASE}"
}
build_firefox_arm() {
docker build -t "${IMAGE}:firefox_arm" -f firefox/Dockerfile --build-arg BASE_IMAGE="${IMAGE}:base_arm" firefox
}
build() {
docker build -t "${IMAGE}:$1" -f "$1/Dockerfile" "$1/"
}
case $1 in
client) build_client;;
server) build_server;;
base) build_base;;
base_arm) build_base_arm;;
firefox_arm) build_firefox_arm;;
*) build "$1";;
esac