production ready image

This commit is contained in:
b1ek 2023-05-17 07:42:00 +10:00
parent 02fa61b645
commit 4ab95432fc
Signed by: blek
GPG Key ID: 14546221E3595D0C
4 changed files with 17 additions and 13 deletions

View File

@ -29,7 +29,7 @@ services:
depends_on:
- db
db:
image: mariadb
image: postgres
networks:
pairent:
aliases:
@ -37,8 +37,9 @@ services:
volumes:
- './data/db:/etc/mysql'
environment:
MARIADB_ROOT_PASSWORD: '${DB_PASSWORD}'
MARIADB_DATABASE: 'pairent_db'
POSTGRES_PASSWORD: '${DB_PASSWORD}'
POSTGRES_DB: 'pairent_db'
POSTGRES_USER: 'root'
networks:
pairent:

View File

@ -1,9 +1,11 @@
FROM python:alpine
RUN apk add --no-cache \
gcc musl-dev \
mysql mariadb-connector-c-dev && \
mkdir /opt/code
# mysql mariadb-connector-c-dev
RUN apk add --no-cache postgresql-libs && \
apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev && \
mkdir /opt/code && \
apk --purge del .build-deps
COPY requirements.txt /opt/code/requirements.txt
WORKDIR /opt/code

View File

@ -97,15 +97,16 @@ WSGI_APPLICATION = 'pairent_backend.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'pairent_db',
'USER': DOTENV['DB_USER'],
'PASSWORD': DOTENV['DB_PASSWORD'],
'HOST': DOTENV['DB_HOST'],
'PORT': DOTENV['DB_PORT'],
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"
}
# 'OPTIONS': {
# 'init_command': "SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci",
# 'charset': 'utf8mb4'
# }
}
}

View File

@ -1,4 +1,4 @@
mysqlclient
psycopg2-binary
django
djangorestframework
django-cors-headers
@ -6,4 +6,4 @@ Pillow
requests
python-ipware
python-dotenv
gunicorn
gunicorn