Skip to content

Commit

Permalink
Добавляет docker-контейнер для запуска фронтенда
Browse files Browse the repository at this point in the history
  • Loading branch information
codEnjoyer committed Nov 16, 2023
1 parent 2318daa commit fc39581
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ PGADMIN_DEFAULT_EMAIL=
PGADMIN_DEFAULT_PASSWORD=

BACK_APP_PORT=
FRONT_APP_PORT=

SECRET_JWT_KEY=
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ services:
- "${BACK_APP_PORT}:${BACK_APP_PORT}"
restart: unless-stopped

frontend:
container_name: react_app
build:
context: ./frontend/
dockerfile: ./Dockerfile
env_file:
- .env
ports:
- "${FRONT_APP_PORT}:${FRONT_APP_PORT}"
restart: unless-stopped

db:
container_name: db_app
image: postgres:15
Expand Down
18 changes: 18 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:20.9-alpine as build

WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY package-lock.json ./

RUN npm ci --silent
RUN npm install react-scripts@3.4.1 -g --silent

COPY . /app/

RUN npm run build
RUN npm install -g serve

CMD serve -s build -l ${FRONT_APP_PORT}

0 comments on commit fc39581

Please sign in to comment.