docker compose overlay file for running `run_pyl` equivalents (#1100)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
b210b84b3a
commit
2469941ea6
40
Makefile
40
Makefile
|
@ -2,6 +2,11 @@ MY_USER := $(shell id -u)
|
|||
MY_GROUP := $(shell id -g)
|
||||
ME := $(MY_USER):$(MY_GROUP)
|
||||
|
||||
SUDO ?= sudo
|
||||
|
||||
ARENA_CONTAINER ?= spiff-arena
|
||||
ARENA_DEV_OVERLAY ?= dev.docker-compose.yml
|
||||
|
||||
BACKEND_CONTAINER ?= spiffworkflow-backend
|
||||
BACKEND_DEV_OVERLAY ?= spiffworkflow-backend/dev.docker-compose.yml
|
||||
|
||||
|
@ -9,14 +14,16 @@ FRONTEND_CONTAINER ?= spiffworkflow-frontend
|
|||
FRONTEND_DEV_OVERLAY ?= spiffworkflow-frontend/dev.docker-compose.yml
|
||||
|
||||
DOCKER_COMPOSE ?= RUN_AS=$(ME) docker compose $(YML_FILES)
|
||||
IN_ARENA ?= $(DOCKER_COMPOSE) run $(ARENA_CONTAINER)
|
||||
IN_BACKEND ?= $(DOCKER_COMPOSE) run $(BACKEND_CONTAINER)
|
||||
IN_FRONTEND ?= $(DOCKER_COMPOSE) run $(FRONTEND_CONTAINER)
|
||||
|
||||
YML_FILES := -f docker-compose.yml \
|
||||
-f $(BACKEND_DEV_OVERLAY) \
|
||||
-f $(FRONTEND_DEV_OVERLAY)
|
||||
-f $(BACKEND_DEV_OVERLAY) \
|
||||
-f $(FRONTEND_DEV_OVERLAY) \
|
||||
-f $(ARENA_DEV_OVERLAY)
|
||||
|
||||
all: dev-env start-dev be-tests-par
|
||||
all: dev-env start-dev run-pyl
|
||||
@/bin/true
|
||||
|
||||
build-images:
|
||||
|
@ -31,16 +38,25 @@ start-dev: stop-dev
|
|||
stop-dev:
|
||||
$(DOCKER_COMPOSE) down
|
||||
|
||||
be-clear-log-file:
|
||||
$(IN_BACKEND) rm -f log/unit_testing.log
|
||||
|
||||
be-mypy:
|
||||
$(IN_BACKEND) poetry run mypy src tests
|
||||
|
||||
be-recreate-db:
|
||||
$(IN_BACKEND) ./bin/recreate_db clean
|
||||
|
||||
be-ruff:
|
||||
$(IN_BACKEND) poetry run ruff --fix .
|
||||
|
||||
be-sh:
|
||||
$(IN_BACKEND) /bin/bash
|
||||
|
||||
be-tests:
|
||||
be-tests: be-clear-log-file
|
||||
$(IN_BACKEND) poetry run pytest
|
||||
|
||||
be-tests-par:
|
||||
be-tests-par: be-clear-log-file
|
||||
$(IN_BACKEND) poetry run pytest -n auto -x --random-order
|
||||
|
||||
fe-lint-fix:
|
||||
|
@ -52,11 +68,21 @@ fe-npm-i:
|
|||
fe-sh:
|
||||
$(IN_FRONTEND) /bin/bash
|
||||
|
||||
pre-commit:
|
||||
$(IN_ARENA) poetry run pre-commit run --verbose --all-files
|
||||
|
||||
run-pyl: fe-lint-fix pre-commit be-mypy be-tests-par
|
||||
@/bin/true
|
||||
|
||||
sh:
|
||||
$(IN_ARENA) /bin/bash
|
||||
|
||||
take-ownership:
|
||||
sudo chown -R $(ME) .
|
||||
$(SUDO) chown -R $(ME) .
|
||||
|
||||
.PHONY: build-images dev-env \
|
||||
start-dev stop-dev \
|
||||
be-recreate-db be-sh be-tests be-tests-par \
|
||||
be-clear-log-file be-recreate-db be-ruff be-sh be-tests be-tests-par \
|
||||
fe-lint-fix fe-npm-i fe-sh \
|
||||
pre-commit run-pyl \
|
||||
take-ownership
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
FROM python:3.12.1-slim-bookworm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y -q git-core curl \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN git config --global --add safe.directory /app
|
||||
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install poetry==1.6.1
|
||||
|
||||
COPY pyproject.toml poetry.lock .
|
||||
RUN poetry install --no-root
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
services:
|
||||
spiff-arena:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: dev.Dockerfile
|
||||
#
|
||||
# TODO: would like to figure out the permissions issue that is preventing this
|
||||
#
|
||||
#user: "${RUN_AS}"
|
||||
volumes:
|
||||
- ./:/app
|
Loading…
Reference in New Issue