split base build to multiple dockerfiles.

This commit is contained in:
Miroslav Šedivý
2024-09-08 17:21:09 +02:00
parent bbefb393f8
commit 38e8ac3e21
79 changed files with 455 additions and 968 deletions
+5 -14
View File
@@ -8,19 +8,10 @@ set -e
GIT_COMMIT=`git rev-parse --short HEAD`
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
# if first argument is nvidia, use nvidia dockerfile
if [ "$1" = "nvidia" ]; then
echo "Building nvidia docker image"
DOCKERFILE="Dockerfile.nvidia"
elif [ "$1" = "intel" ]; then
echo "Building intel docker image"
DOCKERFILE="Dockerfile.intel"
else
echo "Building default docker image"
DOCKERFILE="Dockerfile"
fi
echo "Building server image"
docker build -t neko_server --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../Dockerfile ..
docker build -t neko_server_build --target build --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../$DOCKERFILE ..
docker build -t neko_server_runtime --target runtime --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../$DOCKERFILE ..
BUILD_IMAGE=neko_server FLAVOUR=$1 ../../build
docker build -t neko_server_app --build-arg "BASE_IMAGE=neko_server_runtime" -f ./runtime/Dockerfile ./runtime
echo "Building app image"
docker build -t neko_server:app --build-arg "BASE_IMAGE=neko_server:base" -f ./runtime/Dockerfile ./runtime
+3 -3
View File
@@ -1,12 +1,12 @@
#!/bin/bash
cd "$(dirname "$0")"
if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then
echo "Image 'neko_server_build' not found. Run ./build first."
if [ "$(docker images -q neko_server 2> /dev/null)" == "" ]; then
echo "Image 'neko_server' not found. Run ./build first."
exit 1
fi
docker run -it --rm \
--entrypoint="go" \
-v "${PWD}/../:/src" \
neko_server_build fmt ./...
neko_server fmt ./...
+4 -4
View File
@@ -1,8 +1,8 @@
#!/bin/bash
cd "$(dirname "$0")"
if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then
echo "Image 'neko_server_build' not found. Run ./build first."
if [ "$(docker images -q neko_server 2> /dev/null)" == "" ]; then
echo "Image 'neko_server' not found. Run ./build first."
exit 1
fi
@@ -10,7 +10,7 @@ docker run -it \
--name "neko_server_go" \
--entrypoint="go" \
-v "${PWD}/../:/src" \
neko_server_build "$@";
neko_server "$@";
#
# copy package files
docker cp neko_server_go:/src/go.mod "../go.mod"
@@ -18,7 +18,7 @@ docker cp neko_server_go:/src/go.sum "../go.sum"
#
# commit changes to image
docker commit "neko_server_go" "neko_server_build"
docker commit "neko_server_go" "neko_server"
#
# remove contianer
+3 -3
View File
@@ -1,8 +1,8 @@
#!/bin/bash
cd "$(dirname "$0")"
if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then
echo "Image 'neko_server_build' not found. Run ./build first."
if [ "$(docker images -q neko_server 2> /dev/null)" == "" ]; then
echo "Image 'neko_server' not found. Run ./build first."
exit 1
fi
@@ -11,4 +11,4 @@ fi
docker run --rm -it \
-v "${PWD}/../:/src" \
--entrypoint="/bin/bash" \
neko_server_build -c '[ -f ./bin/golangci-lint ] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.31.0;./bin/golangci-lint run';
neko_server -c '[ -f ./bin/golangci-lint ] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.31.0;./bin/golangci-lint run';
+1 -1
View File
@@ -10,7 +10,7 @@ set -e
docker run --rm -it \
-v "${PWD}/../:/src" \
--entrypoint="/bin/bash" \
neko_server_build "./build" "$@";
neko_server "./build" "$@";
#
# remove old plugins
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
cd "$(dirname "$0")"
cd ../xorg/xf86-input-neko
cd ../../runtime/xorg-deps/xf86-input-neko
#
# aborting if any command returns a non-zero value
+1 -1
View File
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=neko_server_runtime:latest
ARG BASE_IMAGE=neko_server:base
FROM $BASE_IMAGE
ARG SRC_URL="https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"
+3 -3
View File
@@ -1,8 +1,8 @@
#!/bin/bash
cd "$(dirname "$0")"
if [ -z "$(docker images -q neko_server_app 2> /dev/null)" ]; then
echo "Image 'neko_server_app' not found. Running ./build first."
if [ -z "$(docker images -q neko_server:app 2> /dev/null)" ]; then
echo "Image 'neko_server:app' not found. Running ./build first."
./build
fi
@@ -66,4 +66,4 @@ docker run --rm -it \
--shm-size=2G \
--security-opt seccomp=unconfined \
$EXTRAOPTS \
neko_server_app:latest;
neko_server:app;