-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from bendsouza2/bug/docker-lambda-entry
fix lambda and docker integration
- Loading branch information
Showing
10 changed files
with
257 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
httpx==0.27.2 | ||
google-api-python-client==2.94.0 | ||
google-api-core==2.11.1 | ||
openai==1.7.2 | ||
black==23.12.1 | ||
requests~=2.31.0 | ||
deep-translator==1.11.4 | ||
gTTS~=2.5.1 | ||
moviepy~=1.0.3 | ||
scipy==1.12.0 | ||
numpy==1.26.3 | ||
soundfile==0.12.1 | ||
boto3==1.35.7 | ||
fastapi==0.114.0 | ||
pydantic~=2.5.3 | ||
botocore==1.35.7 | ||
pyenchant==3.2.2 | ||
mypy==1.11.2 | ||
python-dotenv==1.0.1 | ||
google-auth==2.22.0 | ||
google-auth-httplib2==0.1.0 | ||
google-auth-oauthlib==1.2.1 | ||
pillow==10.2.0 | ||
mysqlclient==2.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
FROM python:3.10-slim | ||
|
||
WORKDIR /var/task | ||
|
||
# System dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
wget \ | ||
curl \ | ||
gnupg \ | ||
gcc \ | ||
g++ \ | ||
make \ | ||
python3 \ | ||
python3-dev \ | ||
python3-pip \ | ||
python3-venv \ | ||
mariadb-client \ | ||
libmariadb-dev \ | ||
libsndfile1 \ | ||
ffmpeg \ | ||
libenchant-2-2 \ | ||
aspell-es \ | ||
hunspell-es && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Node.js 22 (latest version) | ||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ | ||
apt-get install -y nodejs && \ | ||
npm install -g npm@latest | ||
|
||
# Set Enchant configuration paths | ||
ENV ENCHANT_CONFIG_DIR=/usr/share/hunspell | ||
ENV ENCHANT_DATA_DIR=/usr/share/hunspell | ||
|
||
# Spanish dictionaries | ||
RUN mkdir -p /usr/share/hunspell && \ | ||
curl -o /usr/share/hunspell/es_ES.dic https://cgit.freedesktop.org/libreoffice/dictionaries/plain/es/es_ES.dic && \ | ||
curl -o /usr/share/hunspell/es_ES.aff https://cgit.freedesktop.org/libreoffice/dictionaries/plain/es/es_ES.aff | ||
|
||
# Node.js dependencies | ||
COPY node/package.json /var/task/node/ | ||
RUN cd /var/task/node && npm install | ||
|
||
# Python dependencies | ||
COPY lambda-requirements.txt /var/task/requirements.txt | ||
RUN pip3 install --no-cache-dir -r /var/task/requirements.txt | ||
|
||
COPY . /var/task | ||
|
||
CMD ["python3", "-m", "python.lambda_handler"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from typing import Callable, Type | ||
import logging | ||
from functools import wraps | ||
|
||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.INFO) | ||
|
||
|
||
def get_logger(module_name: str) -> logging.Logger: | ||
""" | ||
Creates and configures a logger for the given module. | ||
Args: | ||
module_name (str): Name of the module requesting the logger. | ||
Returns: | ||
logging.Logger: Configured logger instance. | ||
""" | ||
logger = logging.getLogger(module_name) | ||
if not logger.hasHandlers(): | ||
handler = logging.StreamHandler() | ||
formatter = logging.Formatter( | ||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s" | ||
) | ||
handler.setFormatter(formatter) | ||
logger.addHandler(handler) | ||
logger.setLevel(logging.INFO) | ||
return logger | ||
|
||
|
||
def log_execution(func: Callable) -> Callable: | ||
"""Decorator to log the execution of a function or method.""" | ||
@wraps(func) | ||
def wrapper(*args, **kwargs): | ||
logger.info(f"Entering: {func.__qualname__}") | ||
result = func(*args, **kwargs) | ||
logger.info(f"Exiting: {func.__qualname__}") | ||
return result | ||
return wrapper | ||
|
||
|
||
def log_all_methods(cls: Type): | ||
"""Class decorator to log all method calls in a class.""" | ||
for attr_name, attr_value in cls.__dict__.items(): | ||
if isinstance(attr_value, property): | ||
getter = log_execution(attr_value.fget) if attr_value.fget else None | ||
setter = log_execution(attr_value.fset) if attr_value.fset else None | ||
setattr(cls, attr_name, property(getter, setter)) | ||
elif callable(attr_value): | ||
if isinstance(attr_value, staticmethod): | ||
setattr(cls, attr_name, staticmethod(log_execution(attr_value.__func__))) | ||
elif isinstance(attr_value, classmethod): | ||
setattr(cls, attr_name, classmethod(log_execution(attr_value.__func__))) | ||
else: | ||
setattr(cls, attr_name, log_execution(attr_value)) | ||
return cls | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.