-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
9 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 |
---|---|---|
@@ -1,21 +1,20 @@ | ||
FROM public.ecr.aws/docker/library/python:3.12.0-slim-bullseye | ||
|
||
# Copy aws-lambda-adapter for Steaming response | ||
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.1 /lambda-adapter /opt/extensions/lambda-adapter | ||
|
||
# Copy nltk_lambda_layer for using nltk in lambda | ||
COPY --from=public.ecr.aws/m5s2b0d4/nltk_lambda_layer:latest /nltk_data /opt/nltk_data | ||
|
||
|
||
# Copy function code | ||
COPY . ${LAMBDA_TASK_ROOT} | ||
# from your project folder. | ||
COPY requirements.txt . | ||
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}" -U --no-cache-dir | ||
|
||
# Setup NLTK again in system path to execute nltk.downloader | ||
RUN pip install nltk | ||
# Setup directory for NLTK_DATA | ||
RUN mkdir -p /opt/nltk_data | ||
# Set NLTK_DATA to load nltk_data | ||
ENV NLTK_DATA=/opt/nltk_data | ||
|
||
# Download NLTK_DATA to build directory | ||
RUN python -W ignore -m nltk.downloader punkt -d /opt/nltk_data | ||
RUN python -W ignore -m nltk.downloader stopwords -d /opt/nltk_data | ||
RUN python -W ignore -m nltk.downloader averaged_perceptron_tagger -d /opt/nltk_data | ||
|
||
CMD ["python", "main.py"] | ||
CMD ["python", "main.py"] |