This commit is contained in:
@@ -16,12 +16,12 @@ A simple object storage system that stores files with metadata and provides a RE
|
||||
|
||||
## Building
|
||||
|
||||
To build output/simple-object-server, and the docker image gitea.jde.nz/public/simple-object-server:test, run:
|
||||
To build output/simple-object-server for the current architecture run:
|
||||
```bash
|
||||
./build.sh
|
||||
```
|
||||
|
||||
To test the docker image gitea.jde.nz/public/simple-object-server:test, run:
|
||||
To build and test the docker image gitea.jde.nz/public/simple-object-server:test, run:
|
||||
```bash
|
||||
./test.sh
|
||||
```
|
||||
|
5
build.sh
5
build.sh
@@ -19,9 +19,4 @@ docker build \
|
||||
--output "${SCRIPT_DIR}/output" \
|
||||
"${SCRIPT_DIR}"
|
||||
|
||||
docker buildx build --load \
|
||||
-f "${SCRIPT_DIR}/Dockerfile.sos" \
|
||||
-t gitea.jde.nz/public/simple-object-server:test \
|
||||
"${SCRIPT_DIR}"
|
||||
|
||||
# --platform linux/amd64 \
|
||||
|
50
publish.sh
50
publish.sh
@@ -5,3 +5,53 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
echo "Publishing simple-object-server to gitea.jde.nz/public/simple-object-server:latest"
|
||||
|
||||
# FUNCTIONS
|
||||
function title() {
|
||||
echo "----------------------------------------"
|
||||
# Center the text
|
||||
local text="$1"
|
||||
local line_length=40
|
||||
local text_length=${#text}
|
||||
local padding=$(( (line_length - text_length) / 2 ))
|
||||
printf "%*s%s%*s\n" $padding "" "$text" $padding ""
|
||||
echo "----------------------------------------"
|
||||
}
|
||||
|
||||
|
||||
function die() {
|
||||
title "error: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function build() {
|
||||
local PLATFORM="$1"
|
||||
local PROJECT="simple-object-server"
|
||||
|
||||
# convert linux/amd64 to linux-amd64, windows/amd64 to windows-amd64, etc.
|
||||
local OSARCH="${PLATFORM//\//-}"
|
||||
|
||||
title "Building ${PROJECT} for ${PLATFORM}"
|
||||
|
||||
docker buildx build \
|
||||
-t "gitea.jde.nz/public/${PROJECT}-build:latest" \
|
||||
-f "${SCRIPT_DIR}/Dockerfile.dropshell-build" \
|
||||
--build-arg PROJECT="${PROJECT}" \
|
||||
--build-arg CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
|
||||
--output "${SCRIPT_DIR}/output/${OSARCH}" \
|
||||
--platform "${PLATFORM}" \
|
||||
"${SCRIPT_DIR}"
|
||||
|
||||
mv "${SCRIPT_DIR}/output/${OSARCH}/${PROJECT}" "${SCRIPT_DIR}/output/${PROJECT}-${OSARCH}"
|
||||
rm -rf "${SCRIPT_DIR}/output/${OSARCH}"
|
||||
}
|
||||
|
||||
CMAKE_BUILD_TYPE="Release"
|
||||
|
||||
rm -rf "${SCRIPT_DIR}/output"
|
||||
mkdir -p "${SCRIPT_DIR}/output"
|
||||
|
||||
build "linux/amd64"
|
||||
build "linux/arm64"
|
||||
build "windows/amd64"
|
||||
|
||||
|
6
test.sh
6
test.sh
@@ -5,4 +5,10 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
|
||||
docker buildx build --load \
|
||||
-f "${SCRIPT_DIR}/Dockerfile.sos" \
|
||||
-t gitea.jde.nz/public/simple-object-server:test \
|
||||
"${SCRIPT_DIR}"
|
||||
|
||||
|
||||
"${SCRIPT_DIR}/testing/test-docker.sh"
|
||||
|
Reference in New Issue
Block a user