-
Notifications
You must be signed in to change notification settings - Fork 142
Feat: dockerfile to build the app #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
493d45f
f906345
39b5d55
16a2e4b
a0ab4c7
8312773
1e9c8a3
7e07566
11550fe
a1b0ad2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Stage 1: builder | ||
| FROM node:22-alpine AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # install pnpm & git | ||
| RUN npm install -g pnpm | ||
| RUN apk update && \ | ||
| apk upgrade && \ | ||
| apk add --no-cache git | ||
|
|
||
| RUN git init | ||
dylanflandpro marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| # copy lock, package files and configs | ||
| COPY package.json pnpm-lock.yaml ./ | ||
| COPY run-jiti.js ./ | ||
| COPY src/features/build-info/script-to-generate-json.ts src/features/build-info/build-info.gen.json ./src/features/build-info/ | ||
| COPY prisma/schema.prisma ./prisma/ | ||
|
|
||
| RUN pnpm install --frozen-lockfile | ||
|
|
||
| # copy source | ||
| COPY . . | ||
|
|
||
| ENV NODE_OPTIONS=--max-old-space-size=4096 | ||
|
|
||
| # build app | ||
| RUN pnpm build | ||
|
|
||
|
|
||
| # Stage 2: runtime | ||
| FROM node:22-alpine AS runtime | ||
|
|
||
|
|
||
| WORKDIR /app | ||
|
|
||
| # ENV | ||
| ENV NODE_ENV=production | ||
| ENV HOST=0.0.0.0 | ||
| ENV PORT=3000 | ||
|
|
||
| # install pnpm | ||
| RUN npm install -g pnpm npm-run-all | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. run-p not found if I don't install npm run all |
||
|
|
||
| COPY .env ./ | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
| ## copy output build and package.json from builder | ||
| COPY --from=builder /app/.output ./.output | ||
| COPY --from=builder /app/package.json ./package.json | ||
| COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml | ||
| COPY --from=builder /app/node_modules ./node_modules | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| EXPOSE 3000 | ||
|
|
||
| # start | ||
| CMD ["pnpm", "start"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ | |
| "dk:start": "docker compose start", | ||
| "dk:stop": "docker compose stop", | ||
| "dk:clear": "docker compose down --volumes", | ||
| "dk:build": "docker build -t start-ui-web . && docker run -d --network start-ui-web_default -p 3000:3000 --name start-ui-web-container start-ui-web", | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "db:init": "pnpm db:push && pnpm db:seed", | ||
| "db:push": "prisma db push", | ||
| "db:ui": "prisma studio", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.