draft docker-compose-test.yml

This commit is contained in:
Simone Robutti 2022-09-27 17:26:24 +02:00
parent feee7e7f42
commit 14306ade7e
3 changed files with 72 additions and 0 deletions

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM python:3.10-alpine3.16
ARG ENV_FOR_DYNACONF
ENV ENV_FOR_DYNACONF=${ENV_FOR_DYNACONF} \
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.0.0
# System deps:
RUN pip install "poetry==$POETRY_VERSION"
# Copy only requirements to cache them in docker layer
WORKDIR /app
COPY poetry.lock pyproject.toml /app/
# Project initialization:
RUN poetry config virtualenvs.create false \
&& poetry install $(test "$ENV_FOR_DYNACONF" == production && echo "--no-dev") --no-interaction --no-ansi
# Creating folders, and files for a project:
COPY . /app

45
docker-compose-test.yml Normal file
View File

@ -0,0 +1,45 @@
version: "3.7"
services:
mobilizon-reshare:
image: fishinthecalculator/mobilizon-reshare:v0.3.2
environment:
SECRETS_FOR_DYNACONF: /etc/xdg/mobilizon-reshare/0.3.2/.secrets.toml
ENV_FOR_DYNACONF: production
MOBILIZON_RESHARE_INTERVAL: "*/15 10-18 * * 0-4"
volumes:
- ./.secrets.toml:/etc/xdg/mobilizon-reshare/0.3.2/.secrets.toml:ro
- ./mobilizon_reshare.toml:/etc/xdg/mobilizon-reshare/0.3.2/mobilizon_reshare.toml:ro
- ./var:/var/lib/mobilizon-reshare
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
db:
image: postgres:13
env_file:
- ./.env
volumes:
- postgres-db-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "mobilizon_reshare"]
interval: 5s
retries: 5
expose:
- 5432
web:
build: .
command: poetry run mobilizon-reshare web
#command: sh
environment:
SECRETS_FOR_DYNACONF: /app/.secrets.toml
SETTINGS_FILE_FOR_DYNACONF: /app/settings.toml
ENV_FOR_DYNACONF: development
MOBILIZON_RESHARE_INTERVAL: "*/15 10-18 * * 0-4"
volumes:
- ../reshare_exec/backupsecrets.toml:/app/.secrets.toml
- ../reshare_exec/settings_postgres.toml:/app/settings.toml
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- postgres-db-volume:/var/lib/postgresql
- ./:/app
volumes:
postgres-db-volume:

View File

@ -46,6 +46,7 @@ class MoReDB:
migration_queries_location = pkg_resources.resource_filename(
"mobilizon_reshare", "migrations"
)
command = Command(
tortoise_config=get_tortoise_orm(),
app="models",