Skip to content

Commit a54b291

Browse files
Updated prisma build flow (again).
1 parent 5825a37 commit a54b291

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ jobs:
100100
# This ensures Docker rebuilds the prisma layer when the submodule is updated
101101
PRISMA_COMMIT=$(git submodule status prisma | awk '{print $1}' | sed 's/^+//')
102102
echo "Using Prisma submodule commit: $PRISMA_COMMIT"
103-
# Use 'codebuilder' as the stack prefix with build-arg to bust cache
103+
104+
# Build with the prisma commit as a build argument
104105
docker compose -p codebuilder build --build-arg PRISMA_COMMIT=$PRISMA_COMMIT api
105106
106107
# Step 5: Forcefully remove the old api container to prevent conflicts.

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ COPY package.json pnpm-lock.yaml ./
1313
# Add a build argument to bust cache when the submodule changes
1414
# This ensures that Docker will re-copy the prisma directory when the submodule is updated
1515
ARG PRISMA_COMMIT
16-
# Copy the prisma directory
17-
COPY prisma ./prisma
18-
1916

2017
# Install dependencies
2118
RUN pnpm install --unsafe-perm \
@@ -30,6 +27,12 @@ RUN pnpm install --unsafe-perm \
3027
&& echo '--- DEBUG: node_modules/.bin contents ---' \
3128
&& ls -l node_modules/.bin || true
3229

30+
# Copy prisma directory and generate client based on the commit
31+
# This creates a single layer that will be invalidated when PRISMA_COMMIT changes
32+
COPY prisma ./prisma
33+
RUN echo "Prisma commit: ${PRISMA_COMMIT:-unknown}" > /tmp/prisma-commit \
34+
&& npx prisma generate
35+
3336
# Copy the rest of your application code
3437
COPY . .
3538

0 commit comments

Comments
 (0)