Skip to content

Commit 6e3e012

Browse files
thenav56tnagorra
authored andcommitted
feat(docker): add multistage build for emulator and deployment
1 parent 7b98477 commit 6e3e012

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/docker-push-dev.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
REPO_NAME: ghcr.io/${{ github.repository }}
2222
run: |
2323
REPO_NAME=$(echo $REPO_NAME | tr '[:upper:]' '[:lower:]')
24-
TAG="0.3.2-dev"
24+
TAG="0.3.3-dev"
2525
2626
# Docker
2727
echo "docker_image_name=${REPO_NAME}" >> $GITHUB_OUTPUT
@@ -54,6 +54,7 @@ jobs:
5454
with:
5555
context: .
5656
builder: ${{ steps.buildx.outputs.name }}
57+
target: emulator
5758
file: Dockerfile
5859
push: false
5960
load: true

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NOTE: If you make any BREAKING CHANGE:
22
# - Update the Docker image tag in `./.github/workflows/docker-push-dev.yml`
33
# - Update the `mapswipe-backend` workflow to use the new image tag
4-
FROM node:20-bullseye-slim
4+
FROM node:20-bullseye-slim AS base
55

66
ENV PNPM_HOME="/pnpm"
77
ENV PATH="$PNPM_HOME:$PATH"
@@ -18,9 +18,12 @@ WORKDIR /firebase
1818
ARG FIREBASE_TOOLS_VERSION=14.5.1
1919

2020
RUN --mount=type=cache,target=/root/.npm \
21-
npm install -g firebase-tools@$FIREBASE_TOOLS_VERSION \
22-
# Download jar files
23-
&& firebase setup:emulators:database \
21+
npm install -g firebase-tools@$FIREBASE_TOOLS_VERSION
22+
23+
FROM base AS emulator
24+
25+
# Pre-download firebase emulator tools
26+
RUN firebase setup:emulators:database \
2427
&& firebase setup:emulators:firestore \
2528
&& firebase setup:emulators:storage \
2629
&& firebase setup:emulators:ui

0 commit comments

Comments
 (0)