Skip to content

Commit

Permalink
fix: add ui production target + improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
Emnaghz committed Sep 27, 2024
1 parent 615402c commit c2f6b5a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
file: ./frontend/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
target: production
tags: hexastack/hexabot-ui:latest

- name: Build and push API Docker image
Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ services:
- WATCHPACK_POLLING=true
volumes:
- ../frontend/:/app/frontend/
ports:
- 8081:8081

widget:
build:
Expand Down
42 changes: 20 additions & 22 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,29 @@ RUN \
else echo "Lockfile not found." && exit 1; \
fi

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

WORKDIR /app/frontend

CMD ["npm", "run", "dev", "--", "-p", "8080"]

# Production image, copy all the files and run next
FROM base AS runner
FROM base AS production
WORKDIR /app/frontend

ENV NODE_ENV production
ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1

Expand Down Expand Up @@ -73,23 +91,3 @@ ENV PORT 8080
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
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"]
17 changes: 9 additions & 8 deletions frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ const nextConfig = withTM(["hexabot-widget"])({
},
];
},
webpack: (config => {
config.watchOptions = {
poll: 1000,
aggregateTimeout: 300,
// ignored: ['**/node_modules']
webpack(config) {
if(process.env.NODE_ENV=="development"){
config.watchOptions = {
poll: 1000,
aggregateTimeout: 300,
};
}
return config
}),

return config;
},
publicRuntimeConfig: {
lang: {
default: "en",
Expand Down

0 comments on commit c2f6b5a

Please sign in to comment.