diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c550055 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f4bc908 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +FROM node:18-alpine AS base + +# Install dependencies only when needed +FROM base AS deps +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. +RUN apk add --no-cache libc6-compat +WORKDIR /app + +RUN corepack enable +COPY .yarn ./.yarn +COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .yarnrc.yml ./ + +RUN yarn --frozen-lockfile + + +# Rebuild the source code only when needed +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +ENV NEXT_TELEMETRY_DISABLED=1 + +RUN yarn build + +# Production image, copy all the files and run next +FROM base AS runner +WORKDIR /app + +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public + +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 + +ENV PORT=3000 + +ENV HOSTNAME="0.0.0.0" +CMD ["node", "server.js"] diff --git a/build_docker.sh b/build_docker.sh new file mode 100644 index 0000000..d3f921f --- /dev/null +++ b/build_docker.sh @@ -0,0 +1,4 @@ +sudo docker build -t git.logidex.ru/aserbin/logidex-id-frontend:latest . +sudo docker images git.logidex.ru/aserbin/logidex-id-frontend:latest +sudo docker login git.logidex.ru +sudo docker push git.logidex.ru/aserbin/logidex-id-frontend:latest diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..ab67964 --- /dev/null +++ b/compose.yml @@ -0,0 +1,20 @@ +services: + logidex-id-frontend: + image: git.logidex.ru/aserbin/logidex-id-frontend:latest + container_name: logidex-id-frontend + environment: + - NODE_ENV=production + ports: + - "3001:3000" + restart: unless-stopped + deploy: + resources: + limits: + cpus: "1.0" + memory: "500m" + networks: + - logidex-id-network + +networks: + logidex-id-network: + driver: bridge diff --git a/next.config.mjs b/next.config.mjs index df57197..20cb73d 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -5,6 +5,7 @@ const withBundleAnalyzer = bundleAnalyzer({ }); export default withBundleAnalyzer({ + output: "standalone", reactStrictMode: false, eslint: { ignoreDuringBuilds: true, diff --git a/package.json b/package.json index 0e187d6..8e51141 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "next": "15.3.3", "react": "19.1.0", "react-dom": "19.1.0", - "react-imask": "^7.6.1" + "react-imask": "^7.6.1", + "sharp": "^0.34.3" }, "devDependencies": { "@babel/core": "^7.27.4", diff --git a/test-utils/render.tsx b/test-utils/render.tsx index 71716bd..a6bfe83 100644 --- a/test-utils/render.tsx +++ b/test-utils/render.tsx @@ -1,13 +1,13 @@ import { render as testingLibraryRender } from "@testing-library/react"; import { MantineProvider } from "@mantine/core"; -import { darkTheme } from "@/theme"; +import { theme } from "@/theme"; import React from "react"; export function render(ui: React.ReactNode) { return testingLibraryRender(<>{ui}, { wrapper: ({ children }: { children: React.ReactNode }) => ( {children} diff --git a/yarn.lock b/yarn.lock index fc20984..9336d68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9091,6 +9091,7 @@ __metadata: react: "npm:19.1.0" react-dom: "npm:19.1.0" react-imask: "npm:^7.6.1" + sharp: "npm:^0.34.3" storybook: "npm:^8.6.8" storybook-dark-mode: "npm:^4.0.2" stylelint: "npm:^16.20.0" @@ -11227,7 +11228,7 @@ __metadata: languageName: node linkType: hard -"sharp@npm:^0.34.1": +"sharp@npm:^0.34.1, sharp@npm:^0.34.3": version: 0.34.3 resolution: "sharp@npm:0.34.3" dependencies: