basharin_sevastyan_lab_3 #25

Merged
Alexey merged 7 commits from basharin_sevastyan_lab_3 into main 2023-12-05 22:25:43 +04:00
8 changed files with 97 additions and 0 deletions
Showing only changes of commit 3a9b24d065 - Show all commits

View File

@ -0,0 +1,43 @@
version: '3'
services:
nginx:
image: nginx:latest
ports:
- 80:80
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
restart: always
depends_on:
- product-service
- order-service
networks:
- mynetwork
db:
image: postgres:latest
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: admin
POSTGRES_USER: admin
POSTGRES_DB: message-api
volumes:
- ./database.sql:/docker-entrypoint-initdb.d/database.sql
restart: always
networks:
- mynetwork
user_app:
build:
context: /user_app
dockerfile: Dockerfile
message_app:
build:
context: /message_app
dockerfile: Dockerfile
networks:
mynetwork:
driver: bridge

View File

@ -0,0 +1,8 @@
FROM python:3.9
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
COPY var/data /var/data
COPY var/result /var/result
CMD ["python", "main.py"]

View File

@ -0,0 +1,2 @@
Flask==3.0.0
Werkzeug==3.0.1

View File

@ -0,0 +1,28 @@
events {
worker_connections 1024;
}
http {
upstream user-service {
server product-service:8080;
}
upstream message-service {
server order-service:8081;
}
server {
listen 80;
listen [::]:80;
server_name localhost;
location /user-service/ {
proxy_pass http://user-service/;
}
location /message-service/ {
proxy_pass http://message-service/;
}
}
}

View File

@ -0,0 +1,8 @@
FROM python:3.9
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
COPY var/data /var/data
COPY var/result /var/result
CMD ["python", "main.py"]

View File

@ -0,0 +1,6 @@
from flask import Flask
app = Flask(__name__)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)

View File

@ -0,0 +1,2 @@
Flask==3.0.0
Werkzeug==3.0.1