poprawka nginx

This commit is contained in:
Hubert Dwornik 2024-06-17 00:55:05 +02:00
parent bf77dfe949
commit ae7bfd268c
10 changed files with 4955 additions and 3 deletions

11
certificates/Dockerfile Normal file
View 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
View 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

View File

@ -2,14 +2,13 @@ version: '3.8'
services:
app:
build: .
build: ./connector
ports:
- "5000:8090" # Adjust if your app uses a different port
depends_on:
- db
networks:
- my-bridge-network
db:
image: postgres:13
environment:
@ -49,6 +48,20 @@ services:
networks:
- my-bridge-network
frontend:
container_name: frontend
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "8000:80"
depends_on:
- app
networks:
- my-bridge-network
volumes:
postgres_data:

58
docs/docker-compose.yml Normal file
View 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:

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

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

View 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

File diff suppressed because one or more lines are too long

View File

@ -146,7 +146,7 @@ def AI_recommendations():
if __name__ == "__main__":
config = ConfigParser()
config.read("../connector/Include/init_scripts/constants.ini")
config.read("init_scripts/constants.ini")
while True:
try:

View File

@ -0,0 +1,4 @@
flask==3.0.3
pandas==2.2.2
Flask-Caching==2.3.0
scikit-learn==1.5.0