77 lines
2 KiB
Bash
Executable file
77 lines
2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
VERSION=1.0.0
|
|
APP=mealie
|
|
DEPOT=https://github.com/hay-kot/mealie.git
|
|
GIT_VERSION=last
|
|
DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M)
|
|
DEBIAN_VERSION_CODENAME=bookworm
|
|
IMAGE_SIZE=6
|
|
PACKAGE_DEPENDENCY="curl build-essential libpq-dev libwebp-dev libsasl2-dev libldap2-dev libssl-dev gnupg2 python3-pip python3-dev git wget ca-certificates python3-poetry python3-cachecontrol nodejs yarn"
|
|
|
|
main(){
|
|
base_package_upgrade
|
|
configure_depot_nodejs
|
|
configure_depot_yarn
|
|
install_package_dependency
|
|
get_git_source
|
|
build_frontend
|
|
build_api
|
|
makedeb_frontend
|
|
makedeb_api
|
|
}
|
|
|
|
build_frontend() {
|
|
cd /tmp/${APP}/frontend
|
|
|
|
yarn install
|
|
yarn build
|
|
rm -fr node_modules/
|
|
NODE_ENV=production yarn install
|
|
}
|
|
|
|
build_api() {
|
|
cd /tmp/${APP}/
|
|
|
|
export PYTHONUNBUFFERED=1
|
|
export PYTHONDONTWRITEBYTECODE=1
|
|
export PIP_NO_CACHE_DIR=off
|
|
export PIP_DISABLE_PIP_VERSION_CHECK=on
|
|
export PIP_DEFAULT_TIMEOUT=100
|
|
export POETRY_VIRTUALENVS_IN_PROJECT=true
|
|
export POETRY_NO_INTERACTION=1
|
|
export VENV_PATH="/usr/share/mealie/.venv"
|
|
|
|
[ -e /usr/share/mealie ] && rm -fr /usr/share/mealie
|
|
mkdir /usr/share/mealie
|
|
mv mealie/ alembic* poetry.lock gunicorn_conf.py pyproject.toml /usr/share/mealie
|
|
cd /usr/share/mealie
|
|
poetry install -E pgsql --no-dev
|
|
|
|
export PRODUCTION=true
|
|
/usr/share/mealie/.venv/bin/python /usr/share/mealie/mealie/scripts/install_model.py
|
|
|
|
}
|
|
|
|
makedeb_frontend(){
|
|
PATH_DEB=/tmp/src/rootfs-frontend
|
|
|
|
mkdir -p ${PATH_DEB}/usr/share/mealie/
|
|
cp -fr /tmp/${APP}/frontend ${PATH_DEB}/usr/share/mealie/
|
|
|
|
mkdir -p ${PATH_DEB}/var/lib/mealie/api
|
|
ln -s /usr/share/mealie/alembic ${PATH_DEB}/var/lib/mealie/api/alembic
|
|
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
|
|
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
|
|
}
|
|
|
|
makedeb_api(){
|
|
PATH_DEB=/tmp/src/rootfs-api
|
|
|
|
mkdir -p ${PATH_DEB}/usr/share/
|
|
cp -fr /usr/share/mealie ${PATH_DEB}/usr/share/
|
|
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
|
|
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
|
|
}
|