Docker files

This commit is contained in:
StNicolay 2022-10-14 18:54:29 +03:00
parent 865c98ad46
commit 4702e048f3
4 changed files with 87 additions and 0 deletions

26
.dockerignore Normal file
View File

@ -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

2
.gitignore vendored
View File

@ -160,3 +160,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
# Database data
data/

26
Dockerfile Normal file
View File

@ -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"]

33
compose.yaml Normal file
View File

@ -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