diff --git a/LyricsPy/Dockerfile b/LyricsPy/Dockerfile new file mode 100644 index 0000000..cc4e714 --- /dev/null +++ b/LyricsPy/Dockerfile @@ -0,0 +1,24 @@ +# syntax=docker/dockerfile:1 + +FROM python:3.8-slim-buster + +WORKDIR / + +# set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# install system dependencies +RUN apt-get update && apt-get install -y sqlite3 + +COPY requirements.txt requirements.txt +RUN pip3 install -r requirements.txt + +COPY . . + +# CMD [ "python3", "-m" , "flask", "--app", "padel", "run", "--host=0.0.0.0"] +#CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] + + +# run entrypoint.sh +ENTRYPOINT ["/padel/entrypoint.sh"] \ No newline at end of file diff --git a/LyricsPy/buildConComposeProd.sh b/LyricsPy/buildConComposeProd.sh new file mode 100644 index 0000000..84ab48d --- /dev/null +++ b/LyricsPy/buildConComposeProd.sh @@ -0,0 +1,3 @@ +docker-compose -f docker-compose.prod.yml down +docker rmi padel_padel +docker-compose -f docker-compose.prod.yml up -d --build \ No newline at end of file diff --git a/LyricsPy/docker-compose.prod.yml b/LyricsPy/docker-compose.prod.yml new file mode 100644 index 0000000..02b7984 --- /dev/null +++ b/LyricsPy/docker-compose.prod.yml @@ -0,0 +1,22 @@ +version: '2.2' + +services: + lyrics: + build: . + command: gunicorn --bind 0.0.0.0:5000 app:create_app() + volumes: + - lyrics_prodd:/instance + expose: + - 5000 +# env_file: +# - ./.env.prod + + nginx: + build: ./nginx + ports: + - 1337:80 + depends_on: + - padel + +volumes: + padel_prod: \ No newline at end of file diff --git a/LyricsPy/instance/songs.db b/LyricsPy/instance/songs.db index 3c8b9dd..a02fc2a 100644 Binary files a/LyricsPy/instance/songs.db and b/LyricsPy/instance/songs.db differ diff --git a/LyricsPy/nginx/Dockerfile b/LyricsPy/nginx/Dockerfile new file mode 100644 index 0000000..072b014 --- /dev/null +++ b/LyricsPy/nginx/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1.25 + +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d \ No newline at end of file diff --git a/LyricsPy/nginx/nginx.conf b/LyricsPy/nginx/nginx.conf new file mode 100644 index 0000000..89d9b4b --- /dev/null +++ b/LyricsPy/nginx/nginx.conf @@ -0,0 +1,15 @@ +upstream lyrics { + server lyrics:5000; +} + +server { + + listen 80; + + location / { + proxy_pass http://lyrics; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_redirect off; + } +} \ No newline at end of file