diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..21bf6d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,26 @@ +**/__pycache__ +**/.venv +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md diff --git a/.gitignore b/.gitignore index 5d381cc..5cd369e 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +# Database data +data/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0daffa5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM python:3.10-slim + +# Keeps Python from generating .pyc files in the container +ENV PYTHONDONTWRITEBYTECODE=1 + +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 + +# Install deps +RUN apt update && apt full-upgrade -y +RUN apt install curl gcc -y +RUN curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash +RUN apt install libmariadb3 libmariadb-dev -y + +# Install pip requirements +COPY requirements.txt . +RUN python -m pip install -r requirements.txt + + +WORKDIR /app +COPY . /app + +RUN adduser -u 1000 --disabled-password --gecos "" appuser && chown -R appuser /app +USER appuser + +CMD ["python", "main.py"] \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..1191940 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,33 @@ +version: '3.4' +networks: + password_manager: {} + +services: + passmanager: + build: + context: . + dockerfile: ./Dockerfile + restart: always + environment: + DB_HOST: db + DB_USER: manager + DB_PASS: passwd123! + DB_NAME: passmanager + TG_TOKEN: 12345 + depends_on: + - db + networks: + - password_manager + + db: + image: jc21/mariadb-aria + restart: always + environment: + MYSQL_ROOT_PASSWORD: example123! + MYSQL_DATABASE: passmanager + MYSQL_USER: manager + MYSQL_PASSWORD: passwd123! + volumes: + - ./data:/var/lib/mysql + networks: + - password_manager