diff --git a/.github/workflows/docker-push-dev.yml b/.github/workflows/docker-push-dev.yml index 8c3e99e..0f29223 100644 --- a/.github/workflows/docker-push-dev.yml +++ b/.github/workflows/docker-push-dev.yml @@ -21,7 +21,7 @@ jobs: REPO_NAME: ghcr.io/${{ github.repository }} run: | REPO_NAME=$(echo $REPO_NAME | tr '[:upper:]' '[:lower:]') - TAG="0.0.1-dev" + TAG="0.2.0-dev" # Docker echo "docker_image_name=${REPO_NAME}" >> $GITHUB_OUTPUT diff --git a/Dockerfile b/Dockerfile index bfc448d..2b8b6d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ FROM node:22-bullseye-slim RUN apt-get update -y \ - && apt-get install -y --no-install-recommends openjdk-11-jdk bash procps + && apt-get install -y --no-install-recommends \ + openjdk-11-jdk bash procps git WORKDIR /firebase diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index acd3df0..3b0a708 100755 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -2,11 +2,23 @@ set -e -# TODO: This may need another look -cd functions -yarn install --frozen-lockfile +BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +FIREBASE_FUNCTIONS_DIR="$BASE_DIR/functions/" + +cd "$BASE_DIR" + +# NOTE: when we are using mapswipe-firebase as a submodule inside docker, +# the .git directory is not accessible. The parent .git directory is in host +# system not accesssible by the container +# Inside the container, yarn install fails when we are installing packages from git repository. +# So, we need to switch to /tmp directory as a workaround +echo "[INFO] Installing dependencies for transpiling functions for Firebase..." +cd /tmp/ +yarn --cwd "$FIREBASE_FUNCTIONS_DIR" install --frozen-lockfile + +echo "[INFO] Transpiling functions for Firebase..." +cd "$FIREBASE_FUNCTIONS_DIR" yarn build -cd ../ # PIDs pid=0 @@ -31,6 +43,7 @@ graceful_shutdown() { } # Trap SIGINT and SIGTERM for Docker shutdown + trap graceful_shutdown SIGINT SIGTERM # Start Firebase emulator in background