mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: add ui production target + improve code
This commit is contained in:
parent
615402c88b
commit
c2f6b5af7b
1
.github/workflows/docker.yml
vendored
1
.github/workflows/docker.yml
vendored
@ -58,6 +58,7 @@ jobs:
|
|||||||
file: ./frontend/Dockerfile
|
file: ./frontend/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
|
target: production
|
||||||
tags: hexastack/hexabot-ui:latest
|
tags: hexastack/hexabot-ui:latest
|
||||||
|
|
||||||
- name: Build and push API Docker image
|
- name: Build and push API Docker image
|
||||||
|
@ -49,8 +49,6 @@ services:
|
|||||||
- WATCHPACK_POLLING=true
|
- WATCHPACK_POLLING=true
|
||||||
volumes:
|
volumes:
|
||||||
- ../frontend/:/app/frontend/
|
- ../frontend/:/app/frontend/
|
||||||
ports:
|
|
||||||
- 8081:8081
|
|
||||||
|
|
||||||
widget:
|
widget:
|
||||||
build:
|
build:
|
||||||
|
@ -41,11 +41,29 @@ RUN \
|
|||||||
else echo "Lockfile not found." && exit 1; \
|
else echo "Lockfile not found." && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
FROM base AS development
|
||||||
FROM base AS runner
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
ENV CHOKIDAR_USEPOLLING=true
|
||||||
|
ENV WATCHPACK_POLLING=true
|
||||||
|
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
ENV NODE_ENV production
|
CMD ["npm", "run", "dev", "--", "-p", "8080"]
|
||||||
|
|
||||||
|
# Production image, copy all the files and run next
|
||||||
|
FROM base AS production
|
||||||
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
@ -73,23 +91,3 @@ ENV PORT 8080
|
|||||||
# server.js is created by next build from the standalone output
|
# server.js is created by next build from the standalone output
|
||||||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
|
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
|
||||||
CMD HOSTNAME="0.0.0.0" node server.js
|
CMD HOSTNAME="0.0.0.0" node server.js
|
||||||
|
|
||||||
FROM base AS development
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
ENV NODE_ENV=development
|
|
||||||
ENV CHOKIDAR_USEPOLLING=true
|
|
||||||
ENV WATCHPACK_POLLING=true
|
|
||||||
|
|
||||||
EXPOSE 8081
|
|
||||||
|
|
||||||
WORKDIR /app/frontend
|
|
||||||
|
|
||||||
CMD ["npm", "run", "dev"]
|
|
@ -10,15 +10,16 @@ const nextConfig = withTM(["hexabot-widget"])({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
webpack: (config => {
|
webpack(config) {
|
||||||
config.watchOptions = {
|
if(process.env.NODE_ENV=="development"){
|
||||||
poll: 1000,
|
config.watchOptions = {
|
||||||
aggregateTimeout: 300,
|
poll: 1000,
|
||||||
// ignored: ['**/node_modules']
|
aggregateTimeout: 300,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config;
|
||||||
}),
|
},
|
||||||
publicRuntimeConfig: {
|
publicRuntimeConfig: {
|
||||||
lang: {
|
lang: {
|
||||||
default: "en",
|
default: "en",
|
||||||
|
Loading…
Reference in New Issue
Block a user