feat: enhance Docker setup and update components to utilize userId for parameter and access lists
This commit is contained in:
parent
26fe86f01e
commit
4ae16f0249
18
Dockerfile
18
Dockerfile
|
|
@ -11,6 +11,10 @@ FROM node:20-alpine AS builder
|
|||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ARG NODE_ENV
|
||||
ENV NODE_ENV=$NODE_ENV
|
||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
|
@ -18,9 +22,16 @@ RUN npm run build
|
|||
# Runtime stage
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
# Accept build args and set as env vars
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ARG PORT=3000
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV PORT=3000
|
||||
ENV PORT=$PORT
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
|
||||
# Install prod deps only for runtime
|
||||
COPY package*.json ./
|
||||
|
|
@ -31,5 +42,6 @@ COPY --from=builder /app/.next ./.next
|
|||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/next.config.* ./
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "start"]
|
||||
EXPOSE $PORT
|
||||
|
||||
CMD ["sh", "-c", "node_modules/.bin/next start -H ${HOSTNAME} -p ${PORT}"]
|
||||
|
|
@ -5,10 +5,16 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
NEXT_PUBLIC_API_URL: http://localhost:3000
|
||||
NODE_ENV: production
|
||||
PORT: 3002
|
||||
image: ibank-frontend:latest
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- NEXT_PUBLIC_API_URL=http://localhost:3000
|
||||
- PORT=3000
|
||||
- HOSTNAME=0.0.0.0
|
||||
ports:
|
||||
- "5836:3000"
|
||||
restart: unless-stopped
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -- -p 5836",
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"generate:db-types": "node scripts/generate-db-types.js",
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ export default function ParametersList({ userId }: { userId: string }) {
|
|||
{ name: "param_value", label: "Value" },
|
||||
{ name: "is_active", label: "Active" },
|
||||
]}
|
||||
where={{
|
||||
user_id: userId,
|
||||
}}
|
||||
addSectionLabel="Add Parameter"
|
||||
addSectionUrl={`/d/user/${userId}/parameter/new`}
|
||||
urlData={`/d/user/${userId}/parameter/:parameter_id`}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ export default function UserAccessList({ userId }: { userId: string }) {
|
|||
{ name: "access_value", label: "Value" },
|
||||
{ name: "is_active", label: "Active" },
|
||||
]}
|
||||
where={{
|
||||
user_id: userId,
|
||||
}}
|
||||
addSectionLabel="Add Access"
|
||||
addSectionUrl={`/d/user/${userId}/access/new`}
|
||||
urlData={`/d/user/${userId}/access/:access_id`}
|
||||
|
|
|
|||
Loading…
Reference in New Issue