porządki ostateczne

This commit is contained in:
Hubert Dwornik 2024-06-17 01:25:26 +02:00
parent ae7bfd268c
commit 7e6ec799e6
15 changed files with 4877 additions and 136 deletions

View File

@ -1,26 +1,15 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim
FROM node:latest
# Set the working directory to /app
WORKDIR /app
# Create app directory
WORKDIR /usr/src/app
# Install necessary OS packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Install app dependencies
# Copy the Python script, requirements, and constants.ini file into the container at /app
COPY connector/Include/frontend_AI_connector.py /app/
COPY connector/Include/requirements.txt /app/
COPY connector/Include/init_scripts/constants.ini /app/init_scripts/
COPY connector/Include/init_scripts/movies.csv /app/init_scripts/
# If you also need http-server globally
RUN npm install -g http-server
# Modify requirements.txt to use psycopg2-binary
RUN sed -i 's/psycopg2==2.9.9/psycopg2-binary==2.9.9/' requirements.txt
# Bundle app source
COPY . .
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Run frontend_AI_connector.py when the container launches
CMD ["python", "./frontend_AI_connector.py"]
EXPOSE 8080
CMD ["http-server", "-p 8080"]

View File

@ -1,15 +0,0 @@
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"]

25
analytics/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
# 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 ./analytics.py .
COPY init_scripts/constants.ini ./init_scripts/constants.ini
COPY init_scripts/movies.csv /app/init_scripts/
COPY requirements.txt .
RUN sed -i 's/psycopg2==2.9.9/psycopg2-binary==2.9.9/' 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", "./analytics.py"]

View File

@ -0,0 +1,9 @@
[postgres]
host=db
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

@ -0,0 +1,4 @@
flask==3.0.3
psycopg2==2.9.9
pandas==2.2.2
Flask-Caching==2.3.0

View File

@ -1,11 +0,0 @@
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

View File

@ -1,14 +0,0 @@
#!/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

@ -1,5 +1,5 @@
[postgres]
host=localhost
host=db
database=test_db
user=root
password=root

View File

@ -59,6 +59,24 @@ services:
- app
networks:
- my-bridge-network
movie_rec:
container_name: movie_rec
build: ./movie_recommendations
ports:
- "8081:8081"
depends_on:
- db
networks:
- my-bridge-network
analitics:
container_name: analytics
build: ./analytics
ports:
- "8082:8082"
depends_on:
- db
networks:
- my-bridge-network

View File

@ -1,58 +0,0 @@
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

@ -1,15 +0,0 @@
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

@ -14,6 +14,11 @@ 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
COPY init_scripts/movies.csv /app/init_scripts/
# Modify requirements.txt to use psycopg2-binary
RUN sed -i 's/psycopg2==2.9.9/psycopg2-binary==2.9.9/' requirements.txt
# Install any needed packages specified in requirements.txt
COPY requirements.txt .

View File

@ -1,5 +1,5 @@
[postgres]
host=localhost
host=db
database=test_db
user=root
password=root