forked from jmug/stoatchat
chore: add separate debug Docker build script
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
case "${TARGETARCH}" in
|
||||
"amd64")
|
||||
LINKER_NAME="x86_64-linux-gnu-gcc"
|
||||
LINKER_PACKAGE="gcc-x86-64-linux-gnu"
|
||||
BUILD_TARGET="x86_64-unknown-linux-gnu" ;;
|
||||
"arm64")
|
||||
LINKER_NAME="aarch64-linux-gnu-gcc"
|
||||
LINKER_PACKAGE="gcc-aarch64-linux-gnu"
|
||||
BUILD_TARGET="aarch64-unknown-linux-gnu" ;;
|
||||
esac
|
||||
if [ -z "$TARGETARCH" ]; then
|
||||
:
|
||||
else
|
||||
case "${TARGETARCH}" in
|
||||
"amd64")
|
||||
LINKER_NAME="x86_64-linux-gnu-gcc"
|
||||
LINKER_PACKAGE="gcc-x86-64-linux-gnu"
|
||||
BUILD_TARGET="x86_64-unknown-linux-gnu" ;;
|
||||
"arm64")
|
||||
LINKER_NAME="aarch64-linux-gnu-gcc"
|
||||
LINKER_PACKAGE="gcc-aarch64-linux-gnu"
|
||||
BUILD_TARGET="aarch64-unknown-linux-gnu" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
tools() {
|
||||
apt-get install -y "${LINKER_PACKAGE}"
|
||||
@@ -38,7 +40,12 @@ deps() {
|
||||
tee crates/core/permissions/src/lib.rs |
|
||||
tee crates/core/presence/src/lib.rs |
|
||||
tee crates/core/result/src/lib.rs
|
||||
cargo build --locked --release --target "${BUILD_TARGET}"
|
||||
|
||||
if [ -z "$TARGETARCH" ]; then
|
||||
cargo build --locked --release
|
||||
else
|
||||
cargo build --locked --release --target "${BUILD_TARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
apps() {
|
||||
@@ -51,12 +58,21 @@ apps() {
|
||||
crates/core/permissions/src/lib.rs \
|
||||
crates/core/presence/src/lib.rs \
|
||||
crates/core/result/src/lib.rs
|
||||
cargo build --locked --release --target "${BUILD_TARGET}"
|
||||
mv target _target && mv _target/"${BUILD_TARGET}" target
|
||||
|
||||
if [ -z "$TARGETARCH" ]; then
|
||||
cargo build --locked --release
|
||||
else
|
||||
cargo build --locked --release --target "${BUILD_TARGET}"
|
||||
mv target _target && mv _target/"${BUILD_TARGET}" target
|
||||
fi
|
||||
}
|
||||
|
||||
export RUSTFLAGS="-C linker=${LINKER_NAME}"
|
||||
export PKG_CONFIG_ALLOW_CROSS="1"
|
||||
export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig"
|
||||
if [ -z "$TARGETARCH" ]; then
|
||||
:
|
||||
else
|
||||
export RUSTFLAGS="-C linker=${LINKER_NAME}"
|
||||
export PKG_CONFIG_ALLOW_CROSS="1"
|
||||
export PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig"
|
||||
fi
|
||||
|
||||
"$@"
|
||||
|
||||
19
scripts/publish-debug-image.sh
Normal file
19
scripts/publish-debug-image.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if an argument was provided
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "No arguments provided"
|
||||
echo "Usage: scripts/build-current-arch.sh 20230826-1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[profile.release]" >> Cargo.toml
|
||||
echo "debug = true" >> Cargo.toml
|
||||
|
||||
TAG=$1-debug
|
||||
echo "Building images, will tag for ghcr.io with $TAG-debug!"
|
||||
docker build -t ghcr.io/revoltchat/base:latest -f Dockerfile.useCurrentArch .
|
||||
docker build -t ghcr.io/revoltchat/server:$TAG - < crates/delta/Dockerfile
|
||||
docker build -t ghcr.io/revoltchat/bonfire:$TAG - < crates/bonfire/Dockerfile
|
||||
|
||||
git restore Cargo.toml
|
||||
Reference in New Issue
Block a user