add docker

This commit is contained in:
dominik24c 2022-05-23 14:23:22 +02:00
parent 440187d812
commit a607964114
5 changed files with 83 additions and 1 deletions

View File

@ -1,3 +1,33 @@
# system-pri # system-pri
System organizacji PRI 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
```

2
backend/.dockerignore Normal file
View File

@ -0,0 +1,2 @@
venv
env

15
backend/Dockerfile Normal file
View File

@ -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 . .

22
docker-compose.yaml Normal file
View File

@ -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"

13
frontend/Dockerfile Normal file
View File

@ -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"]