Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ VITE_IS_DEMO="false"
# DATABASE
DATABASE_URL="postgres://${DOCKER_DATABASE_USERNAME}:${DOCKER_DATABASE_PASSWORD}@localhost:${DOCKER_DATABASE_PORT}/${DOCKER_DATABASE_NAME}"

# for docker build use:
# DATABASE_URL="postgres://${DOCKER_DATABASE_USERNAME}:${DOCKER_DATABASE_PASSWORD}start-ui-web-postgres-1/${DOCKER_DATABASE_NAME}"

# AUTH
AUTH_SECRET="REPLACE ME" # You can use `npx @better-auth/cli@latest secret` to a generated secret
AUTH_SESSION_EXPIRATION_IN_SECONDS=2592000 # 30 days
Expand Down
59 changes: 59 additions & 0 deletions Dockerfile
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


# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is npm-run-all needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 ./



## 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
RUN pnpm install --frozen-lockfile

EXPOSE 3000

# start
CMD ["pnpm", "start"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ pnpm dev
>
> Setup a PostgreSQL database (locally or online) and replace the **DATABASE_URL** environment variable. Then you can run `pnpm db:push` to update your database schema and then run `pnpm db:seed` to seed your database.

## Dockerfile

Build the image using the following command

```bash
docker build -t start-ui-web .
```
Then, you can run it with this example command:

```bash
And now you can use this command example to run it `docker run -d --network start-ui-web_default -p 3000:3000 --name start-ui-web-container start-ui-web`
```

During the build process, it automatically uses your project’s .env file.


### Emails in development
Expand Down
Loading