mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 18:23:15 +02:00
porządki ostateczne
This commit is contained in:
parent
ae7bfd268c
commit
7e6ec799e6
31
Dockerfile
31
Dockerfile
@ -1,26 +1,15 @@
|
|||||||
# Use an official Python runtime as a parent image
|
FROM node:latest
|
||||||
FROM python:3.10-slim
|
|
||||||
|
|
||||||
# Set the working directory to /app
|
# Create app directory
|
||||||
WORKDIR /app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
# Install necessary OS packages
|
# Install app dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
build-essential \
|
|
||||||
libpq-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy the Python script, requirements, and constants.ini file into the container at /app
|
# If you also need http-server globally
|
||||||
COPY connector/Include/frontend_AI_connector.py /app/
|
RUN npm install -g http-server
|
||||||
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/
|
|
||||||
|
|
||||||
# Modify requirements.txt to use psycopg2-binary
|
# Bundle app source
|
||||||
RUN sed -i 's/psycopg2==2.9.9/psycopg2-binary==2.9.9/' requirements.txt
|
COPY . .
|
||||||
|
|
||||||
# Install any needed packages specified in requirements.txt
|
EXPOSE 8080
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
CMD ["http-server", "-p 8080"]
|
||||||
|
|
||||||
# Run frontend_AI_connector.py when the container launches
|
|
||||||
CMD ["python", "./frontend_AI_connector.py"]
|
|
||||||
|
|||||||
@ -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
25
analytics/Dockerfile
Normal 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"]
|
||||||
9
analytics/init_scripts/constants.ini
Normal file
9
analytics/init_scripts/constants.ini
Normal 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
|
||||||
4804
analytics/init_scripts/movies.csv
Normal file
4804
analytics/init_scripts/movies.csv
Normal file
File diff suppressed because one or more lines are too long
4
analytics/requirements.txt
Normal file
4
analytics/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
flask==3.0.3
|
||||||
|
psycopg2==2.9.9
|
||||||
|
pandas==2.2.2
|
||||||
|
Flask-Caching==2.3.0
|
||||||
@ -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
|
|
||||||
@ -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
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
[postgres]
|
[postgres]
|
||||||
host=localhost
|
host=db
|
||||||
database=test_db
|
database=test_db
|
||||||
user=root
|
user=root
|
||||||
password=root
|
password=root
|
||||||
|
|||||||
@ -59,6 +59,24 @@ services:
|
|||||||
- app
|
- app
|
||||||
networks:
|
networks:
|
||||||
- my-bridge-network
|
- 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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:
|
|
||||||
@ -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"]
|
|
||||||
@ -14,6 +14,11 @@ COPY movie_recommender.py .
|
|||||||
COPY datasets/tmdb_5000_credits.csv ./movie_recommendations/datasets/
|
COPY datasets/tmdb_5000_credits.csv ./movie_recommendations/datasets/
|
||||||
COPY datasets/tmdb_5000_movies.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/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
|
# Install any needed packages specified in requirements.txt
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
[postgres]
|
[postgres]
|
||||||
host=localhost
|
host=db
|
||||||
database=test_db
|
database=test_db
|
||||||
user=root
|
user=root
|
||||||
password=root
|
password=root
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user