Skip to content

Commit 66f7078

Browse files
committed
fix: use of original boilerplate with python 3.11
1 parent 972173d commit 66f7078

3 files changed

Lines changed: 208 additions & 38 deletions

File tree

Dockerfile

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Layer 1: Build the virtual environment
2-
FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.11 AS builder
2+
FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:3.11 AS builder
33

44
RUN pip install poetry==1.8.3
55

@@ -15,13 +15,13 @@ RUN --mount=type=cache,target=$POETRY_CACHE_DIR \
1515
poetry install --without dev --no-root
1616

1717
# Layer 2: Download NLTK models
18-
FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.11 AS models
18+
FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:3.11 AS models
1919

2020
ENV NLTK_DATA=/usr/share/nltk_data
2121

22-
ENV MODEL_PATH=/app/evaluation_function/models
22+
ENV MODEL_PATH=/app/app/models
2323

24-
RUN apt-get update && apt-get install -y --no-install-recommends \
24+
RUN yum install -y \
2525
wget \
2626
unzip
2727

@@ -31,17 +31,17 @@ RUN ./scripts/download_models.sh
3131
RUN ./scripts/download_nltk.sh
3232

3333
# Layer 3: Final image
34-
FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.11
34+
FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:3.11
3535

3636
ENV VIRTUAL_ENV=/app/.venv \
3737
PATH="/app/.venv/bin:$PATH"
3838

3939
ENV NLTK_DATA=/usr/share/nltk_data
4040

41-
ENV MODEL_PATH=/app/evaluation_function/models
41+
ENV MODEL_PATH=/app/app/models
4242

4343
# Copy the evaluation function to the app directory
44-
COPY ./evaluation_function ./evaluation_function
44+
COPY ./evaluation_function ./app
4545

4646
# Precompile python files for faster startup
4747
RUN python -m compileall -q .
@@ -50,34 +50,9 @@ COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
5050
COPY --from=models ${NLTK_DATA} ${NLTK_DATA}
5151
COPY --from=models ${MODEL_PATH} ${MODEL_PATH}
5252

53-
# ----- For Linux development instead of Layer 2 NLTK downloads
54-
# # Warnings: those commands sometimes download corrupted zips, so it is better to wget each package from the main site
55-
# RUN python -m nltk.downloader wordnet
56-
# RUN python -m nltk.downloader word2vec_sample
57-
# RUN python -m nltk.downloader brown
58-
# RUN python -m nltk.downloader stopwords
59-
# RUN python -m nltk.downloader punkt
60-
# RUN python -m nltk.downloader punkt_tab
53+
# Set permissions so files and directories can be accessed on AWS
54+
RUN chmod 644 $(find ./app/ -type f)
55+
RUN chmod 755 $(find ./app/ -type d)
6156

62-
# Worker process start timeout to allow shimmy to start considering all downloads
63-
ENV FUNCTION_WORKER_SEND_TIMEOUT="600s"
64-
65-
# Worker process stop timeout to allow shimmy to stop the container
66-
ENV FUNCTION_WORKER_STOP_TIMEOUT="300s"
67-
68-
ENV EVAL_RPC_TRANSPORT="ipc"
69-
70-
# Command to start the evaluation function with
71-
ENV FUNCTION_COMMAND="python"
72-
73-
# Args to start the evaluation function with
74-
ENV FUNCTION_ARGS="-m,evaluation_function.main"
75-
76-
# The transport to use for the RPC server
77-
ENV FUNCTION_RPC_TRANSPORT="ipc"
78-
79-
ENV LOG_LEVEL="debug"
80-
81-
# ------- FOR DEBIAN
82-
# Keep the container running
83-
# CMD ["tail", "-f", "/dev/null"]
57+
# The entrypoint for AWS is to invoke the handler function within the app package
58+
CMD [ "/app/app.handler" ]

poetry.lock

Lines changed: 192 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ lf_toolkit = { git = "https://github.com/lambda-feedback/toolkit-python.git", br
2626
"parsing",
2727
"ipc",
2828
] }
29+
jsonschema = "^4.23.0"
30+
evaluation-function-utils = "^0.1.3"
31+
black = "^24.10.0"
32+
autopep8 = "^2.3.1"
2933

3034
[tool.poetry.group.dev.dependencies]
3135
pytest = "^8.2.2"

0 commit comments

Comments
 (0)