-
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.
- Loading branch information
RandomNick2
committed
Oct 19, 2024
1 parent
3c2764c
commit 5233fbd
Showing
8 changed files
with
71 additions
and
29 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 |
---|---|---|
@@ -1,18 +1,38 @@ | ||
FROM node:lts-alpine | ||
# Stage 1: Build the NestJS app | ||
FROM node:lts-alpine AS build | ||
|
||
WORKDIR /docker | ||
WORKDIR /docker/backend | ||
|
||
# Копируем package.json и yarn.lock для установки зависимостей | ||
COPY package.json yarn.lock ./ | ||
|
||
RUN yarn install --frozen-lockfile | ||
# Устанавливаем зависимости | ||
RUN yarn install | ||
|
||
# Копируем остальные файлы | ||
COPY . . | ||
|
||
# RUN yarn prisma migrate deploy | ||
# Генерируем Prisma Client | ||
RUN yarn prisma generate | ||
|
||
# Сборка проекта | ||
RUN yarn build | ||
|
||
# Stage 2: Запуск приложения | ||
FROM node:lts-alpine | ||
|
||
WORKDIR /docker/backend | ||
|
||
# Копируем только необходимые файлы для работы приложения | ||
COPY --from=build /docker/backend/dist ./dist | ||
COPY --from=build /docker/backend/package.json ./ | ||
COPY --from=build /docker/backend/yarn.lock ./ | ||
|
||
# Устанавливаем только производственные зависимости | ||
RUN yarn install --production=true | ||
|
||
# Открываем порт | ||
EXPOSE 3000 | ||
|
||
# Запускаем приложение | ||
CMD ["yarn", "start:prod"] |
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
This file was deleted.
Oops, something went wrong.
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 +1 @@ | ||
VITE_API_BASE_URL=http://localhost:3000/api | ||
VITE_API_BASE_URL=http://localhost/api |
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,12 +1,28 @@ | ||
FROM node:lts-alpine | ||
# Dockerfile | ||
|
||
WORKDIR /docker | ||
# Stage 1: Build Vue app | ||
FROM node:lts-alpine AS build | ||
WORKDIR /docker/frontend | ||
|
||
COPY package*.json ./ | ||
RUN yarn install --frozen-lockfile | ||
# Copy only the essential files for install and build | ||
COPY package.json yarn.lock ./ | ||
RUN yarn install | ||
|
||
# Copy the rest of the project files | ||
COPY . . | ||
|
||
# Build the Vue app | ||
RUN yarn build | ||
|
||
# Stage 2: Serve with Nginx | ||
FROM nginx:stable-alpine AS production | ||
|
||
# Copy built files from the build stage to the Nginx directory | ||
RUN ls | ||
COPY --from=build /docker/frontend/dist /usr/share/nginx/html | ||
# Nginx config (if needed) | ||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
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