Skip to content

Commit b46feba

Browse files
thenav56tnagorra
authored andcommitted
fix(yarn): add git
- fix yarn install with mapswipe-firebase as submodule inside docker
1 parent 99b44f6 commit b46feba

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
FROM node:22-bullseye-slim
55

66
RUN apt-get update -y \
7-
&& apt-get install -y --no-install-recommends openjdk-11-jdk bash procps
7+
&& apt-get install -y --no-install-recommends \
8+
openjdk-11-jdk bash procps git
89

910
WORKDIR /firebase
1011

docker_entrypoint.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22

33
set -e
44

5-
# TODO: This may need another look
6-
cd functions
7-
yarn install --frozen-lockfile
5+
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
FIREBASE_FUNCTIONS_DIR="$BASE_DIR/functions/"
7+
8+
cd "$BASE_DIR"
9+
10+
# NOTE: when we are using mapswipe-firebase as a submodule inside docker,
11+
# the .git directory is not accessible. The parent .git directory is in host
12+
# system not accesssible by the container
13+
# Inside the container, yarn install fails when we are installing packages from git repository.
14+
# So, we need to switch to /tmp directory as a workaround
15+
cd /tmp/
16+
yarn --cwd "$FIREBASE_FUNCTIONS_DIR" install --frozen-lockfile
17+
18+
cd "$FIREBASE_FUNCTIONS_DIR"
819
yarn build
9-
cd ../
1020

1121
# PIDs
1222
pid=0
@@ -31,6 +41,7 @@ graceful_shutdown() {
3141
}
3242

3343
# Trap SIGINT and SIGTERM for Docker shutdown
44+
3445
trap graceful_shutdown SIGINT SIGTERM
3546

3647
# Start Firebase emulator in background

0 commit comments

Comments
 (0)