-
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
Showing
13 changed files
with
160 additions
and
66 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
VITE_API_URL=http://localhost:8000/ | ||
|
||
FLASK_ENV=development | ||
API_NINJAS_KEY=<key> | ||
GOOGLE_MAPS_API_KEY=<key> | ||
|
||
FRONTEND_PORT=3000 | ||
BACKEND_PORT=8000 |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Should be specified in an .env file at the frontend root path! | ||
# VITE_API_URL=http://localhost:8080/api/ | ||
|
||
FLASK_ENV=production | ||
API_NINJAS_KEY=<key> | ||
GOOGLE_MAPS_API_KEY=<key> |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
.env.prod | ||
|
||
.idea |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# IASA-Champ-24 | ||
|
||
## Deploying with Docker | ||
|
||
### Development | ||
|
||
Copy .env.example as .env and edit the necessary variables. | ||
|
||
``docker compose up --build`` | ||
|
||
Frontend part of the application is available on port $FRONTEND_PORT (default: 3000). | ||
Backend part of the application is available on port $BACKEND_PORT (default: 8000). | ||
|
||
### Production | ||
|
||
Copy .env.prod.example as .env.prod and ./frontend/.env.example as ./frontend/.env and edit the necessary variables. | ||
|
||
``docker compose -f docker-compose.prod.yml --env-file .env.prod up --build`` | ||
|
||
The application is available on port 8080. Accessing backend is possible on the /api root. |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY requirements.txt /app | ||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||
pip3 install -r requirements.txt | ||
|
||
COPY . /app |
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,65 +1,4 @@ | ||
anyio==3.6.2 | ||
asgiref==3.6.0 | ||
blinker==1.7.0 | ||
blis==0.7.10 | ||
catalogue==2.0.9 | ||
certifi==2023.7.22 | ||
charset-normalizer==3.2.0 | ||
click==8.1.3 | ||
confection==0.1.1 | ||
cymem==2.0.7 | ||
Django==4.2.1 | ||
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.6.0/en_core_web_sm-3.6.0-py3-none-any.whl#sha256=83276fc78a70045627144786b52e1f2728ad5e29e5e43916ec37ea9c26a11212 | ||
en-core-web-trf @ https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.6.1/en_core_web_trf-3.6.1-py3-none-any.whl#sha256=f9a1f0ae83954c49ebf92c0f7043ea02de51db59bf6cd3ed849d46928612c806 | ||
fastapi==0.95.0 | ||
filelock==3.12.3 | ||
Flask==3.0.1 | ||
Flask-Cors==4.0.0 | ||
fsspec==2023.9.0 | ||
h11==0.14.0 | ||
httptools==0.5.0 | ||
huggingface-hub==0.16.4 | ||
idna==3.4 | ||
itsdangerous==2.1.2 | ||
Jinja2==3.1.2 | ||
langcodes==3.3.0 | ||
MarkupSafe==2.1.3 | ||
mpmath==1.3.0 | ||
murmurhash==1.0.9 | ||
networkx==3.1 | ||
numpy==1.24.2 | ||
packaging==23.1 | ||
pathy==0.10.2 | ||
preshed==3.0.8 | ||
protobuf==4.21.12 | ||
pydantic==1.10.6 | ||
python-dotenv==1.0.0 | ||
PyYAML==6.0 | ||
regex==2023.8.8 | ||
requests==2.31.0 | ||
safetensors==0.3.3 | ||
smart-open==6.3.0 | ||
sniffio==1.3.0 | ||
spacy==3.6.1 | ||
spacy-alignments==0.9.0 | ||
spacy-legacy==3.0.12 | ||
spacy-loggers==1.0.4 | ||
spacy-transformers==1.2.5 | ||
sqlparse==0.4.4 | ||
srsly==2.4.7 | ||
starlette==0.26.1 | ||
sympy==1.12 | ||
thinc==8.1.12 | ||
tokenizers==0.13.3 | ||
torch==2.0.1 | ||
tqdm==4.66.1 | ||
transformers==4.30.2 | ||
typer==0.9.0 | ||
typing_extensions==4.5.0 | ||
urllib3==2.0.4 | ||
uvicorn==0.21.1 | ||
uvloop==0.17.0 | ||
wasabi==1.1.2 | ||
watchfiles==0.18.1 | ||
websockets==10.4 | ||
Werkzeug==3.0.1 | ||
flask_cors==4.0.0 | ||
python-dotenv==1.0.1 | ||
Requests==2.31.0 |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: "3.8" | ||
|
||
services: | ||
frontend: | ||
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile.prod | ||
network: host | ||
command: serve -s build -l 5173 | ||
env_file: | ||
- .env.prod | ||
depends_on: | ||
- backend | ||
backend: | ||
build: | ||
context: ./backend | ||
network: host | ||
command: flask run --host 0.0.0.0 | ||
env_file: | ||
- .env.prod | ||
stop_signal: SIGINT | ||
nginx: | ||
build: ./nginx | ||
container_name: dev-nginx | ||
ports: | ||
- "8080:80" | ||
restart: always | ||
depends_on: | ||
- frontend | ||
- backend |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: "3.8" | ||
|
||
services: | ||
frontend: | ||
build: ./frontend | ||
command: npm run dev -- --host 0.0.0.0 --port 5173 | ||
ports: | ||
- "${FRONTEND_PORT}:5173" | ||
env_file: | ||
- .env | ||
tty: true | ||
environment: | ||
- CHOKIDAR_USEPOLLING=true | ||
volumes: | ||
- ./frontend/:/srv/app | ||
- /srv/app/node_modules | ||
depends_on: | ||
- backend | ||
backend: | ||
build: ./backend | ||
command: flask run --host 0.0.0.0 | ||
env_file: | ||
- .env | ||
stop_signal: SIGINT | ||
ports: | ||
- '${BACKEND_PORT}:5000' |
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,2 +1 @@ | ||
VITE_API_URL=http://localhost:4040/ | ||
|
||
VITE_API_URL=http://localhost:8080/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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:18 | ||
|
||
WORKDIR /srv/app/ | ||
|
||
ENV PATH /srv/app/node_modules/.bin:$PATH | ||
|
||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
RUN npm i | ||
|
||
COPY . ./ |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:18 as builder | ||
ENV NODE_ENV production | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json . | ||
RUN npm i | ||
|
||
COPY . . | ||
|
||
RUN npm run build | ||
|
||
FROM node:18 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN npm install -g serve | ||
|
||
COPY --from=builder /app/dist ./build |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM nginx:stable-alpine | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
COPY /nginx.conf /etc/nginx/conf.d |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
server { | ||
# Docker will map 8080 to 80 | ||
listen 80; | ||
|
||
location = /api { | ||
return 302 /api/; | ||
} | ||
|
||
location /api/ { | ||
proxy_pass http://backend:5000/; | ||
proxy_redirect default; | ||
} | ||
|
||
location / { | ||
proxy_pass http://frontend:5173; | ||
proxy_redirect default; | ||
} | ||
} |