mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 17:03:12 +02:00
poprawka nginx
This commit is contained in:
parent
bf77dfe949
commit
ae7bfd268c
11
certificates/Dockerfile
Normal file
11
certificates/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --no-cache openssl
|
||||||
|
|
||||||
|
WORKDIR /certs
|
||||||
|
|
||||||
|
COPY gen_crt.sh .
|
||||||
|
|
||||||
|
RUN chmod +x gen_crt.sh
|
||||||
|
|
||||||
|
RUN /bin/sh ./gen_crt.sh
|
||||||
14
certificates/gen_crt.sh
Normal file
14
certificates/gen_crt.sh
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
openssl genrsa -out ca_rec.key 2048
|
||||||
|
openssl req -x509 -new -nodes -key ca_rec.key -sha256 -days 1024 -out ca_rec.crt -subj "/CN=AnCA"
|
||||||
|
|
||||||
|
openssl genrsa -out connector.key 2048
|
||||||
|
openssl req -new -key connector.key -out connector.csr -subj "/CN=connector"
|
||||||
|
openssl x509 -req -in connector.csr -CA ca_rec.crt -CAkey ca_rec.key -CAcreateserial -out connector.crt -days 500 -sha256
|
||||||
|
|
||||||
|
openssl genrsa -out rec.key 2048
|
||||||
|
openssl req -new -key rec.key -out rec.csr -subj "/CN=rec"
|
||||||
|
openssl x509 -req -in rec.csr -CA ca_rec.crt -CAkey ca_rec.key -CAcreateserial -out rec.crt -days 500 -sha256
|
||||||
|
|
||||||
|
cat rec.crt
|
||||||
@ -2,14 +2,13 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build: .
|
build: ./connector
|
||||||
ports:
|
ports:
|
||||||
- "5000:8090" # Adjust if your app uses a different port
|
- "5000:8090" # Adjust if your app uses a different port
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
networks:
|
networks:
|
||||||
- my-bridge-network
|
- my-bridge-network
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:13
|
image: postgres:13
|
||||||
environment:
|
environment:
|
||||||
@ -49,6 +48,20 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- my-bridge-network
|
- my-bridge-network
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
container_name: frontend
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
networks:
|
||||||
|
- my-bridge-network
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|
||||||
|
|||||||
58
docs/docker-compose.yml
Normal file
58
docs/docker-compose.yml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
recommendations:
|
||||||
|
build: ./movie_recommendations
|
||||||
|
ports:
|
||||||
|
- 5001:5001
|
||||||
|
depends_on:
|
||||||
|
- cert
|
||||||
|
volumes:
|
||||||
|
- ./movie_recommendations:/app2
|
||||||
|
- certs:/certs
|
||||||
|
app:
|
||||||
|
build: ./connector
|
||||||
|
volumes:
|
||||||
|
- ./connector/Include:/app
|
||||||
|
- certs:/certs
|
||||||
|
ports:
|
||||||
|
- "8090:8090" # Adjust if your app uses a different port
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- cert
|
||||||
|
db:
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: test_db
|
||||||
|
POSTGRES_USER: root
|
||||||
|
POSTGRES_PASSWORD: root
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
pgadmin:
|
||||||
|
container_name: admin_container
|
||||||
|
image: dpage/pgadmin4
|
||||||
|
ports:
|
||||||
|
- 8080:80
|
||||||
|
environment:
|
||||||
|
PGADMIN_DEFAULT_EMAIL: admin@admin.com
|
||||||
|
PGADMIN_DEFAULT_PASSWORD: admin
|
||||||
|
frontend:
|
||||||
|
container_name: frontend
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
depends_on:
|
||||||
|
- app
|
||||||
|
cert:
|
||||||
|
build: ./certificates
|
||||||
|
volumes:
|
||||||
|
- certs:/certs
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
certs:
|
||||||
15
frontend/Dockerfile_frontend
Normal file
15
frontend/Dockerfile_frontend
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM node:latest
|
||||||
|
|
||||||
|
# Create app directory
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Install app dependencies
|
||||||
|
|
||||||
|
# If you also need http-server globally
|
||||||
|
RUN npm install -g http-server
|
||||||
|
|
||||||
|
# Bundle app source
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["http-server", "-p 8080"]
|
||||||
24
movie_recommendations/Dockerfile
Normal file
24
movie_recommendations/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Use an official Python runtime as a parent image
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
# Set the working directory to /app2
|
||||||
|
WORKDIR /app2
|
||||||
|
|
||||||
|
# Install necessary OS packages
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy the Python script, requirements, and datasets into the container at /app2
|
||||||
|
COPY movie_recommender.py .
|
||||||
|
COPY datasets/tmdb_5000_credits.csv ./movie_recommendations/datasets/
|
||||||
|
COPY datasets/tmdb_5000_movies.csv ./movie_recommendations/datasets/
|
||||||
|
COPY init_scripts/constants.ini ./init_scripts/constants.ini
|
||||||
|
|
||||||
|
# Install any needed packages specified in requirements.txt
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
RUN pip install requests
|
||||||
|
|
||||||
|
# Run frontend_AI_connector.py when the container launches
|
||||||
|
CMD ["python", "./movie_recommender.py"]
|
||||||
9
movie_recommendations/init_scripts/constants.ini
Normal file
9
movie_recommendations/init_scripts/constants.ini
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[postgres]
|
||||||
|
host=localhost
|
||||||
|
database=test_db
|
||||||
|
user=root
|
||||||
|
password=root
|
||||||
|
port=5432
|
||||||
|
|
||||||
|
[movie]
|
||||||
|
csv_path=../../movie_recommendations/datasets/tmdb_5000_credits.csv
|
||||||
4804
movie_recommendations/init_scripts/movies.csv
Normal file
4804
movie_recommendations/init_scripts/movies.csv
Normal file
File diff suppressed because one or more lines are too long
@ -146,7 +146,7 @@ def AI_recommendations():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.read("../connector/Include/init_scripts/constants.ini")
|
config.read("init_scripts/constants.ini")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|||||||
4
movie_recommendations/requirements.txt
Normal file
4
movie_recommendations/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
flask==3.0.3
|
||||||
|
pandas==2.2.2
|
||||||
|
Flask-Caching==2.3.0
|
||||||
|
scikit-learn==1.5.0
|
||||||
Loading…
Reference in New Issue
Block a user