From 0ef1edeb9eaf2ae190d483758cc0a0d54e5d0064 Mon Sep 17 00:00:00 2001 From: Hubert Dwornik Date: Sun, 16 Jun 2024 21:21:54 +0200 Subject: [PATCH] minor fix --- connector/Dockerfile | 29 +++++++++++++++++++++++++++++ docker-compose.yml | 4 ++-- frontend/Dockerfile | 2 +- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 connector/Dockerfile diff --git a/connector/Dockerfile b/connector/Dockerfile new file mode 100644 index 00000000..a262af2d --- /dev/null +++ b/connector/Dockerfile @@ -0,0 +1,29 @@ +# Use an official Python runtime as a parent image +FROM python:3.10-slim + +# Set the working directory to /app +WORKDIR /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/* + +# Copy the Python script, requirements, and constants.ini file into the container at /app +COPY Include/frontend_AI_connector.py /app/ +COPY Include/requirements.txt /app/ +COPY Include/init_scripts/constants.ini /app/init_scripts/ +COPY Include/init_scripts/movies.csv /app/init_scripts/ +# tls +# COPY ./certs/connector.crt /app/ +# COPY ./certs/connector.key /app/ + +# 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 +RUN pip install --no-cache-dir -r requirements.txt + +# Run frontend_AI_connector.py when the container launches +CMD ["python", "./frontend_AI_connector.py"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 41c77898..31f6e428 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: app: - build: . + build: ./connector volumes: - ./connector/Include:/app ports: @@ -34,7 +34,7 @@ services: context: ./frontend dockerfile: Dockerfile ports: - - "80:80" + - "8000:80" depends_on: - app diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 4dace1a5..b9928e17 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -14,6 +14,6 @@ FROM nginx:stable-alpine COPY --from=build-stage /app/dist /usr/share/nginx/html -EXPOSE 80 +EXPOSE 8000 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file