diff --git a/docker-compose.yml b/docker-compose.yml index 2711f8e..f4fbf4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,8 @@ services: context: ./python dockerfile: dockerfiles/python.dockerfile args: + - USER=${USER:-app} + - GROUP=${GROUP:-app} - UID=${UID:-1000} - GID=${GID:-1000} command: python3 app.py @@ -13,7 +15,6 @@ services: - "5000:5000" volumes: - ./python:/python:Z - - ./php/src:/var/www/html:delegated depends_on: - redis networks: @@ -23,11 +24,11 @@ services: container_name: get_discography_postgres image: postgres:12 ports: - - "5432:5432" + - "${DB_PORT:-5432}:5432" environment: - - POSTGRES_DB=postgres - - POSTGRES_PASSWORD=temp_pg_pass - - POSTGRES_USER=odoo + - POSTGRES_DB=${DB_NAME:-postgres} + - POSTGRES_PASSWORD=${DB_PASS:-password} + - POSTGRES_USER=${DB_USER:-pg_admin} - PGDATA=/var/lib/postgresql/data/pgdata networks: - lan diff --git a/python/.env.example b/python/.env.example index 6cbbf8e..445fb7b 100644 --- a/python/.env.example +++ b/python/.env.example @@ -1,5 +1,9 @@ -DB_HOST=localhost +USER=app +GROUP=app +UID=1000 +GID=1000 +DB_HOST=docker.host.internal DB_PORT=5432 DB_NAME=postgres -DB_USER=postgres +DB_USER=pg_admin DB_PASS=password \ No newline at end of file diff --git a/python/api/process.py b/python/api/process.py index 2ff1879..622bd3b 100644 --- a/python/api/process.py +++ b/python/api/process.py @@ -1,6 +1,5 @@ import requests from utils.download import download_album -import json def process_artist_queue(): diff --git a/python/dockerfiles/python.dockerfile b/python/dockerfiles/python.dockerfile index eba9b01..78951c8 100644 --- a/python/dockerfiles/python.dockerfile +++ b/python/dockerfiles/python.dockerfile @@ -9,14 +9,14 @@ RUN pip3 install -r requirements.txt ENV FLASK_APP=app # Set user and group -ARG user=app -ARG group=app -ARG uid=1000 -ARG gid=1000 -RUN groupadd -g ${gid} ${group} -RUN useradd -u ${uid} -g ${group} -s /bin/sh -m ${user} +ARG USER=app +ARG GROUP=app +ARG UID=1000 +ARG GID=1000 +RUN groupadd -g ${GID} ${GROUP} +RUN useradd -u ${UID} -g ${GROUP} -s /bin/sh -m ${USER} # Switch to user -USER ${uid}:${gid} +USER ${UID}:${GID} CMD ["python3","-u","app.py"] diff --git a/python/utils/musicbrainz.py b/python/utils/musicbrainz.py index aa9bc02..8d8743c 100644 --- a/python/utils/musicbrainz.py +++ b/python/utils/musicbrainz.py @@ -13,7 +13,7 @@ import time # ---------------------------------------------------- musicbrainzngs.set_useragent( name="getDiscography", - version="0.1", + version="0.3", contact="akros@voxelixia.com" ) diff --git a/python/utils/psqldb.py b/python/utils/psqldb.py index c2e0802..5b5173b 100644 --- a/python/utils/psqldb.py +++ b/python/utils/psqldb.py @@ -1,7 +1,4 @@ from __future__ import annotations - -import os -import sys from typing import Any, Dict, Iterable, List, Optional, Tuple import psycopg2