Skip to content

Commit

Permalink
Add startup prisma migration to server Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-va committed Apr 17, 2024
1 parent 3c4db5f commit ca921af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/server-asset-sg/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM node:20-alpine as api-builder

ENV NODE_ENV=development

WORKDIR /app
COPY . .

Expand All @@ -10,8 +12,13 @@ RUN npx nx build server-asset-sg
# final image build
FROM node:20-alpine

ENV NODE_ENV=production

WORKDIR /app
COPY --from=api-builder /app/dist/apps/server-asset-sg .
COPY --from=api-builder /app/node_modules ./node_modules
COPY apps/server-asset-sg/docker/start.sh start.sh
RUN chmod +x start.sh

CMD ["node", "main.js"]
ENTRYPOINT ["sh"]
CMD ["start.sh"]
4 changes: 4 additions & 0 deletions apps/server-asset-sg/docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

npx prisma migrate deploy || exit 1
node main.js

0 comments on commit ca921af

Please sign in to comment.