diff --git a/README.md b/README.md index 943e047..e37ca57 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ # system-pri -System organizacji PRI \ No newline at end of file +System organizacji PRI + + +## Usage +Run application and init database +```bash +docker-compose up -d --build +docker-compose exec backend flask db upgrade +``` + +Turn off application +```bash +docker-compose down +``` + +Show logs +```bash +docker-compose logs -f +``` + +## Development +Run concrete commands: \ +For backend: +```bash +docker-compose exec backend flask db migrate +``` + +For frontend: +```bash +docker-compose exec frontend npm i bootstrap@4 +``` \ No newline at end of file diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..b8a1259 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,2 @@ +venv +env \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..5a21c42 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.8-slim-buster + +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +WORKDIR /app + +RUN apt update && pip install --upgrade pip + +COPY requirements.txt . + +RUN pip install -r requirements.txt + +COPY . . + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2dcab0f --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,22 @@ +version: '3.3' + +services: + backend: + build: ./backend + command: flask run --host 0.0.0.0 --port 5000 + env_file: + - ./backend/.env + volumes: + - ./backend:/app + ports: + - "5000:5000" + + frontend: + build: ./frontend + volumes: + - ./frontend:/app + - /app/node_modules + depends_on: + - backend + ports: + - "3000:3000" \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..589945b --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,13 @@ +FROM node:16-alpine + +WORKDIR /app + +COPY package.json . + +RUN npm i + +RUN mkdir node_modules/.cache && chmod -R 777 node_modules/.cache + +COPY . . + +CMD ["npm","start"] \ No newline at end of file