Skip to content

Commit

Permalink
chore: dockeriza firebase emulators
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermeais committed Sep 20, 2022
1 parent d56db39 commit f18d8b3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Dockerfile.firebase.emulator
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:16.17

ADD . /src
WORKDIR /src
# Install OpenJDK-11
RUN echo 'deb http://ftp.debian.org/debian stretch-backports main' | tee /etc/apt/sources.list.d/stretch-backports.list

RUN apt-get update && \
apt-get install -y openjdk-11-jre-headless && \
apt-get clean;
RUN npm i -g firebase-tools
RUN firebase --version
EXPOSE 4000 9000
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,19 @@ services:
ports:
- "3000:3000"
- "9222:9222"
firebase-emulator:
build:
context: .
dockerfile: Dockerfile.firebase.emulator
image: firebase-emulator:firebase-emulator
volumes:
- .:/src
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:4000" ]
interval: 30s
timeout: 10s
retries: 5
ports:
- 4000:4000
- 9000:9000
command: firebase emulators:start
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@
"version": "1.0.0",
"main": "src/main/server.js",
"scripts": {
"firebase:emulator": "docker-compose up firebase-emulator -d",

"debug": "nodemon --experimental-specifier-resolution=node -L --watch src/main/server.js --inspect=0.0.0.0:9222 --nolazy ./src/main/server.js",
"start": "nodemon --experimental-specifier-resolution=node src/main/server.js ",
"start:docker": "docker-compose up api",

"test": "cross-env NODE_ENV=testing vitest",
"test:unit": "npm run test -- --config vitest.unit.config.js",
"test:integration": "npm run test -- --config vitest.integration.config.js"
"test:integration": "npm run firebase:emulator && npm run test -- --config vitest.integration.config.js",
"posttest:integration": "docker-compose down",

"test:coverage": "npm run firebase:emulator && npm run test -- --coverage",
"posttest:coverage": "docker-compose down"

},
"keywords": [],
"author": "Guilherme Teixeira Ais",
Expand Down

0 comments on commit f18d8b3

Please sign in to comment.