Skip to content

Commit

Permalink
feat: Implement module ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
drorganvidez committed Jul 7, 2024
1 parent ceaad2d commit b9be5b4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
Empty file added .moduleignore
Empty file.
14 changes: 14 additions & 0 deletions core/managers/module_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,25 @@ def __init__(self, app):
self.base_dir = os.path.abspath(os.path.dirname(__file__))
working_dir = os.getenv('WORKING_DIR', '')
self.modules_dir = os.path.join(working_dir, 'app/modules')
self.ignored_modules_file = os.path.join(working_dir, 'app/.moduleignore')
self.ignored_modules = self._load_ignored_modules()

def _load_ignored_modules(self):
ignored_modules = []
if os.path.exists(self.ignore_file):
with open(self.ignored_modules_file, 'r') as f:
ignored_modules = [line.strip() for line in f.readlines()]
return ignored_modules

def register_modules(self):
self.app.modules = {}
self.app.blueprint_url_prefixes = {}

for module_name in os.listdir(self.modules_dir):

if module_name in self.ignored_modules:
continue

module_path = os.path.join(self.modules_dir, module_name)
if (os.path.isdir(module_path) and not module_name.startswith('__') and
os.path.exists(os.path.join(module_path, '__init__.py')) and
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.prod.ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../scripts:/app/scripts
- ../migrations:/app/migrations
- ../uploads:/app/uploads
- ../.moduleignore:/app/.moduleignore
command: [ "sh", "-c", "sh /app/entrypoint.sh" ]

db:
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../scripts:/app/scripts
- ../migrations:/app/migrations
- ../uploads:/app/uploads
- ../.moduleignore:/app/.moduleignore
command: [ "sh", "-c", "sh /app/entrypoint.sh" ]

db:
Expand Down
16 changes: 2 additions & 14 deletions docker/images/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ RUN apk add --no-cache mariadb-client \
&& apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev libffi-dev \
&& apk add --no-cache curl \
&& apk add --no-cache bash \
&& apk add --no-cache openrc \
&& apk add --no-cache git

# Install Docker
RUN apk add --no-cache \
device-mapper \
shadow \
&& curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz | tar xzvf - --strip 1 -C /usr/local/bin docker/docker \
&& curl -fsSL "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose \
&& addgroup docker \
&& adduser -S -G docker user \
&& adduser user root
&& apk add --no-cache openrc

# Set the working directory in the container to /app
WORKDIR /app
Expand Down Expand Up @@ -46,4 +34,4 @@ ARG VERSION_TAG
RUN echo $VERSION_TAG > /app/.version

# Expose port 5000
EXPOSE 5000
EXPOSE 5000

0 comments on commit b9be5b4

Please sign in to comment.