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