-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD: E2E; FIX: Security, Tests, Validation
- Loading branch information
1 parent
cf533ab
commit e4ab528
Showing
11 changed files
with
304 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Удалите директории и файлы, которые не нужны в образе | ||
node_modules | ||
/.next/ | ||
/build | ||
.DS_Store | ||
.vscode/ | ||
package-lock.json | ||
test-results/ | ||
.env.development | ||
.env.production | ||
next-env.d.ts | ||
storybook.log | ||
|
||
# Локальные файлы | ||
*.log | ||
*.tmp | ||
*.swp | ||
*.swo | ||
|
||
# Скрытые директории | ||
.git/ | ||
|
||
# Тесты | ||
/tests/ | ||
*.spec.js | ||
*.test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
AUTH_API_URL=http://localhost:4444 | ||
JWT_SECRET=secret123 | ||
NODE_ENV=production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
AUTH_API_URL= | ||
JWT_SECRET= | ||
NODE_ENV= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,44 @@ | ||
FROM node:18-alpine | ||
# Этап 1: Билд | ||
FROM node:18-alpine AS builder | ||
|
||
# Устанавливаем рабочую директорию | ||
WORKDIR /app | ||
COPY yarn.lock ./ | ||
RUN yarn | ||
COPY . . | ||
|
||
# Копируем только необходимые файлы для установки зависимостей | ||
COPY yarn.lock package.json ./ | ||
RUN yarn install --ignore-scripts | ||
|
||
# Копируем только исходный код и конфигурационные файлы | ||
COPY src/ ./src/ | ||
COPY public/ ./public/ | ||
COPY tsconfig.json ./ | ||
|
||
# Собираем проект | ||
RUN yarn build | ||
|
||
# Этап 2: Прод | ||
FROM node:18-alpine | ||
|
||
# Создаем нового пользователя и группу без прав суперпользователя | ||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
|
||
# Устанавливаем рабочую директорию | ||
WORKDIR /app | ||
|
||
# Копируем собранные файлы из этапа сборки | ||
COPY --from=builder /app/build ./build | ||
|
||
# Изменяем владельца файлов приложения на нового пользователя | ||
RUN chown -R appuser:appgroup /app | ||
|
||
# Переключаемся на нового пользователя | ||
USER appuser | ||
|
||
# Устанавливаем переменную окружения | ||
ENV NODE_ENV=production | ||
CMD ["yarn", "start"] | ||
|
||
# Открываем порт приложения | ||
EXPOSE 3000 | ||
|
||
# Команда для запуска приложения | ||
CMD ["yarn", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.