39 lines
938 B
Bash
Executable File
39 lines
938 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SRC_DIR="/tmp/barcode-src"
|
|
OUT_APPIMAGE="/workspace/BarcodeServer-x86_64.AppImage"
|
|
|
|
rm -rf "${SRC_DIR}"
|
|
mkdir -p "${SRC_DIR}/server"
|
|
|
|
tar -C /workspace/server \
|
|
--exclude='./venv' \
|
|
--exclude='./venv_unix' \
|
|
--exclude='./venv_win' \
|
|
--exclude='./build' \
|
|
--exclude='./dist' \
|
|
--exclude='./__pycache__' \
|
|
--exclude='./.DS_Store' \
|
|
-cf - . | tar -C "${SRC_DIR}/server" -xf -
|
|
|
|
cd "${SRC_DIR}"
|
|
|
|
BUILD_ARGS=(server/build_binary.py --onedir --windowed --appdir)
|
|
if [ -n "${APP_VERSION:-}" ]; then
|
|
BUILD_ARGS+=(--version "${APP_VERSION}")
|
|
fi
|
|
|
|
python "${BUILD_ARGS[@]}"
|
|
|
|
ARCH=x86_64 appimagetool \
|
|
"${SRC_DIR}/server/dist/BarcodeServer.AppDir" \
|
|
"${OUT_APPIMAGE}"
|
|
|
|
chmod +x "${OUT_APPIMAGE}"
|
|
APPIMAGE_EXTRACT_AND_RUN=1 "${OUT_APPIMAGE}" --version
|
|
|
|
if [ -n "${HOST_UID:-}" ] && [ -n "${HOST_GID:-}" ]; then
|
|
chown "${HOST_UID}:${HOST_GID}" "${OUT_APPIMAGE}"
|
|
fi
|