add docker
This commit is contained in:
parent
440187d812
commit
a607964114
30
README.md
30
README.md
@ -1,3 +1,33 @@
|
||||
# system-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
2
backend/.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
venv
|
||||
env
|
15
backend/Dockerfile
Normal file
15
backend/Dockerfile
Normal 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
22
docker-compose.yaml
Normal 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
13
frontend/Dockerfile
Normal 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"]
|
Loading…
Reference in New Issue
Block a user