Compare commits

...

4 commits

3 changed files with 48 additions and 16 deletions

View file

@ -29,13 +29,13 @@ LABEL maintainer="Sebastian Ramirez <tiangolo@gmail.com>"
WORKDIR /usr/local/share/uvicorn-gunicorn WORKDIR /usr/local/share/uvicorn-gunicorn
# install uvicorn-gunicorn # install uvicorn-gunicorn
COPY "./deploy/mini-tiangolo/" "." COPY ./deploy/mini-tiangolo ./
RUN set -ex; \ RUN set -ex; \
chmod +x start.sh; \ chmod +x start.sh; \
python3 -m pip --no-cache-dir install gunicorn; python3 -m pip --no-cache-dir install gunicorn;
CMD ["/usr/local/share/uvicorn-gunicorn/start.sh"] CMD "/usr/local/share/uvicorn-gunicorn/start.sh"
########### ###########
# web app # # web app #
@ -53,17 +53,21 @@ EXPOSE 8000
COPY api ./ COPY api ./
RUN set -ex; \ RUN set -ex; \
# install libs # building hiredis
BUILD_DEPS="${BUILD_DEPS:-} gcc libc6-dev"; \
\
# install dependencies
export DEBIAN_FRONTEND=noninteractive; \ export DEBIAN_FRONTEND=noninteractive; \
apt-get update; apt-get install --yes --no-install-recommends \ apt-get update; apt-get install --yes --no-install-recommends \
libmagic1 \ libmagic1 \
# need to build hiredis ${BUILD_DEPS:-} \
gcc \
libc-dev \
; rm -rf /var/lib/apt/lists/*; \ ; rm -rf /var/lib/apt/lists/*; \
\ \
# install ovdashboard_api # install ovdashboard_api
python3 -m pip --no-cache-dir install ./ python3 -m pip --no-cache-dir install ./; \
\
# remove buildtime dependencies
apt-get autoremove --yes --purge ${BUILD_DEPS:-};
# add prepared ovdashboard_ui # add prepared ovdashboard_ui
COPY --from=build-ui /tmp/ovdashboard_ui /usr/local/share/ovdashboard_ui COPY --from=build-ui /tmp/ovdashboard_ui /usr/local/share/ovdashboard_ui

View file

@ -3,10 +3,31 @@
script="$( readlink -f "${0}" )" script="$( readlink -f "${0}" )"
script_dir="$( dirname "${script}" )" script_dir="$( dirname "${script}" )"
git_version="$( \ [ "$( git rev-parse --abbrev-ref HEAD )" = "develop" ] \
git rev-parse --abbrev-ref HEAD \ && git_status="developing"
| cut -d '/' -f 2 git rev-parse --abbrev-ref HEAD | grep -E 'release|hotfix/' >/dev/null \
)" && git_status="releasing"
if [ "${git_status}" = "developing" ]; then
echo "Status: Developing"
# => version from most recent tag
git_version="$( \
git describe --tags --abbrev=0 \
| sed -E 's/^v[^0-9]*((0|[1-9][0-9]*)[0-9\.]*[0-9]).*$/\1/'
)"
elif [ "${git_status}" = "releasing" ]; then
echo "Status: Releasing"
# => version from releasing branch
git_version="$( \
git rev-parse --abbrev-ref HEAD \
| cut -d '/' -f 2
)"
else
echo "ERROR: Invalid git branch"
echo "ERROR: Chores cannot be run on '$( git rev-parse --abbrev-ref HEAD )'!"
exit 2
fi
api_version="$( \ api_version="$( \
grep '^version' "${script_dir}/../../api/pyproject.toml" \ grep '^version' "${script_dir}/../../api/pyproject.toml" \
@ -14,8 +35,8 @@ api_version="$( \
)" )"
ui_version="$( \ ui_version="$( \
python3 -c 'import sys, json; print(json.load(sys.stdin)["version"])' \ grep '"version":' "${script_dir}/../../ui/package.json" \
< "${script_dir}/../../ui/package.json" \ | sed -E 's/.*"version":[^0-9]*((0|[1-9][0-9]*)[0-9\.]*[0-9]).*$/\1/'
)" )"
install_version="$( \ install_version="$( \

View file

@ -6,12 +6,19 @@ script_dir="$( dirname "${script}" )"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. "${script_dir}/check_version" . "${script_dir}/check_version"
# defined in `check_version` script # vars defined in `check_version` script
# shellcheck disable=SC2154 # shellcheck disable=SC2154
echo "${git_version}" >/dev/null if [ "${git_status}" = "releasing" ]; then
# shellcheck disable=SC2154
image_tag="${git_version}"
else
image_tag="latest"
fi
echo "Building Tag '${image_tag}'"
docker buildx build \ docker buildx build \
--pull --push \ --pull --push \
--tag "code.yavook.de/oekzident.de/ovdashboard:${git_version}" \ --tag "code.yavook.de/oekzident.de/ovdashboard:${image_tag}" \
--platform "linux/amd64,linux/arm64" \ --platform "linux/amd64,linux/arm64" \
"${script_dir}/../.." "${script_dir}/../.."