-
Notifications
You must be signed in to change notification settings - Fork 0
feat: added dockerfile to web app and fixed vite config to use --host #34
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
Changes from all commits
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,26 @@ | ||
| FROM node:22-slim AS build | ||
| ENV PNPM_HOME="/pnpm" | ||
| ENV PATH="$PNPM_HOME:$PATH" | ||
| RUN corepack enable && corepack prepare pnpm@9.0.0 --activate | ||
|
|
||
| WORKDIR /app | ||
| COPY pnpm-lock.yaml pnpm-workspace.yaml package.json turbo.json ./ | ||
| COPY apps/web/ ./apps/web/ | ||
| COPY apps/api/ ./apps/api/ | ||
| COPY packages/ ./packages/ | ||
| RUN pnpm install --frozen-lockfile | ||
| RUN pnpm --filter @repo/api build | ||
| RUN pnpm --filter @repo/api-client build | ||
| ARG NEXT_PUBLIC_API_URL | ||
| ARG NEXT_PUBLIC_REALTIME_URL | ||
| ARG NEXT_PUBLIC_MAX_FILE_UPLOAD_SIZE | ||
| ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL | ||
| ENV NEXT_PUBLIC_REALTIME_URL=$NEXT_PUBLIC_REALTIME_URL | ||
| ENV NEXT_PUBLIC_MAX_FILE_UPLOAD_SIZE=$NEXT_PUBLIC_MAX_FILE_UPLOAD_SIZE | ||
| RUN pnpm --filter web build | ||
|
|
||
| FROM nginx:alpine | ||
| COPY --from=build /app/apps/web/dist /usr/share/nginx/html | ||
| COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf | ||
| EXPOSE 3000 | ||
| CMD ["nginx", "-g", "daemon off;"] | ||
|
Comment on lines
+22
to
+26
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -e
rg -n '^(FROM|USER|EXPOSE|CMD)\b' apps/web/DockerfileRepository: BuckyMcYolo/townhall Length of output: 166 Add a The final stage starts with 🧰 Tools🪛 Checkov (3.2.510)[low] 1-20: Ensure that HEALTHCHECK instructions have been added to container images (CKV_DOCKER_2) [low] 1-20: Ensure that a user for the container has been created (CKV_DOCKER_3) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| server { | ||
| listen 3000; | ||
| root /usr/share/nginx/html; | ||
| index index.html; | ||
|
|
||
| location / { | ||
| try_files $uri $uri/ /index.html; | ||
| } | ||
|
|
||
| location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { | ||
| expires 1y; | ||
| add_header Cache-Control "public, immutable"; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,20 @@ services: | |
| redis: | ||
| condition: service_healthy | ||
|
|
||
| web: | ||
| build: | ||
| context: . | ||
| dockerfile: apps/web/Dockerfile | ||
| args: | ||
| NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8080} | ||
| NEXT_PUBLIC_REALTIME_URL: ${NEXT_PUBLIC_REALTIME_URL:-http://localhost:8000} | ||
|
Comment on lines
+118
to
+120
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. Don't ship These values are compiled into the SPA during the image build. Once the app is opened from another machine, 🤖 Prompt for AI Agents |
||
| restart: unless-stopped | ||
| ports: | ||
| - "3000:3000" | ||
| depends_on: | ||
| api: | ||
| condition: service_started | ||
|
|
||
| volumes: | ||
| postgres_data: | ||
| redis_data: | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,7 +33,7 @@ const serverSchema = z.object({ | |||||||||||||||||||||||||
| REALTIME_CORS_ORIGIN: z.string().default(DEFAULT_REALTIME_CORS_ORIGIN), | ||||||||||||||||||||||||||
| REDIS_URL: z.string().url(), | ||||||||||||||||||||||||||
| BETTER_AUTH_SECRET: z.string().min(1), | ||||||||||||||||||||||||||
| SELF_HOSTED: z.coerce.boolean().default(true), | ||||||||||||||||||||||||||
| SELF_HOSTED: z.coerce.boolean().default(false), | ||||||||||||||||||||||||||
|
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. Keep the new
🤖 Prompt for AI Agents🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -e
echo "Current parser:"
sed -n '34,37p' packages/env/src/server.ts
echo
echo "JavaScript truthiness used by z.coerce.boolean():"
node - <<'NODE'
for (const value of ["true", "false", "1", "0", "", undefined]) {
console.log(`${String(value)} -> ${Boolean(value)}`)
}
NODERepository: BuckyMcYolo/townhall Length of output: 409 Replace
🔧 Proposed fix- SELF_HOSTED: z.coerce.boolean().default(false),
+ SELF_HOSTED: z
+ .preprocess((value) => {
+ if (typeof value === "boolean") return value
+ if (typeof value === "string") {
+ const normalized = value.trim().toLowerCase()
+ if (normalized === "true") return true
+ if (normalized === "false") return false
+ }
+ return value
+ }, z.boolean())
+ .default(false),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| MAX_FILE_UPLOAD_SIZE: z.coerce.number().default(DEFAULT_MAX_FILE_UPLOAD_SIZE), | ||||||||||||||||||||||||||
| NEXT_PUBLIC_API_URL: z.string().min(1).transform(addProtocol), | ||||||||||||||||||||||||||
| S3_ENDPOINT: z.string().url(), | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.