Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Python
**/__pycache__
**/*.py[cod]
**/*.pyo
**/.venv
**/venv
**/myvenv
**/*.egg-info
**/.pytest_cache

# Node
**/node_modules
**/.next
**/out
**/build

# Environment — never bake secrets into images
**/.env
**/.env.local

# Version control and editor
.git
.gitignore
.DS_Store
.vscode
.idea

# macOS
**/.DS_Store

# Docs — not needed inside images
*.md
LICENSE
8 changes: 8 additions & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copy this file to .env and fill in real values.
# Never commit your actual .env file.

# Required for GitHub URL-based classification (embedding_url.py)
GITHUB_TOKEN=your_github_token_here

# Required for OSDG external API classification (app.py)
OSDG_TOKEN=your_osdg_token_here
20 changes: 20 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1

FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 5000

CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"]
5 changes: 5 additions & 0 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
CORS(app)


@app.route('/health', methods=['GET'])
def health():
return jsonify({'status': 'ok'}), 200



@app.route('/api/hello', methods=['GET'])
def hello():
Expand Down
53 changes: 53 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# One-command local setup for UNSDG-classifier-tool
#
# Usage:
# cp backend/.env.example backend/.env
# # fill in GITHUB_TOKEN and OSDG_TOKEN in backend/.env
# docker compose up --build
#
# Frontend → http://localhost:3000
# Backend → http://localhost:5000

services:

backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "5000:5000"
env_file:
- ./backend/.env
environment:
- FLASK_ENV=development
- FLASK_DEBUG=1
- FLASK_APP=app.py
volumes:
- ./backend:/app
- /app/__pycache__
- hf-model-cache:/root/.cache/huggingface
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s

frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_API_URL=http://localhost:5000
volumes:
- ./frontend:/app
- /app/node_modules
- /app/.next
depends_on:
backend:
condition: service_healthy

volumes:
hf-model-cache:
14 changes: 14 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# syntax=docker/dockerfile:1

FROM node:18-alpine

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci

COPY . .

EXPOSE 3000

CMD ["npm", "run", "dev"]
2 changes: 1 addition & 1 deletion frontend/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SDGClassificationResponse,
} from "@/types/main";

const API_BASE_URL = "http://127.0.0.1:5000/";
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://127.0.0.1:5000/";

const apiClient = axios.create({
baseURL: API_BASE_URL,
Expand Down