diff --git a/config/.env.example b/config/.env.example index 8748b68..0c62f48 100644 --- a/config/.env.example +++ b/config/.env.example @@ -12,6 +12,7 @@ ### ANKISYNCD_SESSION_MANAGER ### ANKISYNCD_USER_MANAGER ### ANKISYNCD_COLLECTION_WRAPPER +### ANKISYNCD_COMMIT=e719131720151b51f14242ff7cf898916e3b074c ## Djankiserv ### DJANKISERV_VARS_SOURCED="yes" @@ -41,4 +42,4 @@ ## Make AWK=awk BASH=bash -DOCKER_COMPOSE=docker-compose \ No newline at end of file +DOCKER_COMPOSE=docker-compose diff --git a/services/anki-sync-server/images/Dockerfile b/services/anki-sync-server/images/Dockerfile index 167114d..9311207 100644 --- a/services/anki-sync-server/images/Dockerfile +++ b/services/anki-sync-server/images/Dockerfile @@ -9,10 +9,13 @@ WORKDIR ${ANKISYNCD_ROOT} COPY bin/download-release.sh ./bin/download-release.sh +ARG ANKISYNCD_COMMIT='latest' +LABEL ANKISYNCD_COMMIT=${ANKISYNCD_COMMIT} + ARG PYTHONUSERBASE RUN sh ./bin/download-release.sh && \ pip3 install --upgrade pip && \ - pip3 install --user -r ./release/requirements.txt + pip3 install --user -r ./release/requirements.txt # -- DEPLOYER -- FROM python:3.9-slim-buster diff --git a/services/anki-sync-server/images/bin/download-release.sh b/services/anki-sync-server/images/bin/download-release.sh index 1ce1fa9..0a4380a 100755 --- a/services/anki-sync-server/images/bin/download-release.sh +++ b/services/anki-sync-server/images/bin/download-release.sh @@ -1,6 +1,7 @@ #!/bin/sh # file: download-release.sh +set -eu mkdir -p release @@ -8,8 +9,14 @@ cd release git clone https://github.com/ankicommunity/anki-sync-server +if [ "${ANKISYNCD_COMMIT}" != 'latest' ]; then + cd anki-sync-server + git checkout "${ANKISYNCD_COMMIT}" + cd .. +fi + mv anki-sync-server/src/* . rm -rf anki-sync-server -cd .. \ No newline at end of file +cd .. diff --git a/services/anki-sync-server/images/docker-compose.yml b/services/anki-sync-server/images/docker-compose.yml index dd481fe..57a330b 100644 --- a/services/anki-sync-server/images/docker-compose.yml +++ b/services/anki-sync-server/images/docker-compose.yml @@ -11,4 +11,5 @@ services: - ANKISYNCD_BASE_URL=${ANKISYNCD_BASE_URL:-/sync/} - ANKISYNCD_BASE_MEDIA_URL=${ANKISYNCD_BASE_MEDIA_URL:-/msync/} - ANKISYNCD_AUTH_DB_PATH=${ANKISYNCD_AUTH_DB_PATH:-./auth.db} - - ANKISYNCD_SESSION_DB_PATH=${ANKISYNCD_SESSION_DB_PATH:-./session.db} \ No newline at end of file + - ANKISYNCD_SESSION_DB_PATH=${ANKISYNCD_SESSION_DB_PATH:-./session.db} + - ANKISYNCD_COMMIT=${ANKISYNCD_COMMIT:-latest}