|
1 |
| -# Base image that bundles AWS Lambda Python 3.8 image with some middleware functions |
2 |
| -# FROM base-eval-tmp |
3 |
| -FROM rabidsheep55/python-base-eval-layer |
4 |
| - |
5 |
| -RUN yum install -y git |
6 |
| - |
7 |
| -WORKDIR /app |
8 |
| - |
9 |
| -# Copy and install any packages/modules needed for your evaluation script. |
10 |
| -COPY requirements.txt . |
11 |
| -RUN pip3 install -r requirements.txt |
12 |
| - |
13 |
| -# Copy main scripts |
14 |
| -COPY evaluation.py ./app/ |
15 |
| -COPY evaluation_tests.py ./app/ |
16 |
| -COPY preview.py ./app/ |
17 |
| -COPY preview_tests.py ./app/ |
18 |
| - |
19 |
| -# Copy contexts |
20 |
| -COPY context/physical_quantity.py ./app/context/ |
21 |
| -COPY context/symbolic.py ./app/context/ |
22 |
| - |
23 |
| -# Copy feedback messages |
24 |
| -COPY feedback/physical_quantity.py ./app/feedback/ |
25 |
| -COPY feedback/symbolic.py ./app/feedback/ |
26 |
| - |
27 |
| -# Copy preview implementations |
28 |
| -COPY preview_implementations/physical_quantity_preview.py ./app/preview_implementations/ |
29 |
| -COPY preview_implementations/symbolic_preview.py ./app/preview_implementations/ |
30 |
| - |
31 |
| -# Copy tests |
32 |
| -COPY tests/example_tests.py ./app/tests/ |
33 |
| -COPY tests/physical_quantity_evaluation_tests.py ./app/tests/ |
34 |
| -COPY tests/physical_quantity_preview_tests.py ./app/tests/ |
35 |
| -COPY tests/slr_quantity_tests.py ./app/tests/ |
36 |
| -COPY tests/symbolic_evaluation_tests.py ./app/tests/ |
37 |
| -COPY tests/symbolic_preview_tests.py ./app/tests/ |
38 |
| - |
39 |
| -# Copy utility code |
40 |
| -COPY utility/criteria_graph_utilities.py ./app/utility/ |
41 |
| -COPY utility/criteria_parsing.py ./app/utility/ |
42 |
| -COPY utility/evaluation_result_utilities.py ./app/utility/ |
43 |
| -COPY utility/expression_utilities.py ./app/utility/ |
44 |
| -COPY utility/physical_quantity_utilities.py ./app/utility/ |
45 |
| -COPY utility/preview_utilities.py ./app/utility/ |
46 |
| -COPY utility/slr_parsing_utilities.py ./app/utility/ |
47 |
| -COPY utility/syntactical_comparison_utilities.py ./app/utility/ |
48 |
| -COPY utility/unit_system_conversions.py ./app/utility/ |
49 |
| - |
50 |
| -# Copy Documentation |
51 |
| -COPY docs/dev.md ./app/docs/dev.md |
52 |
| -COPY docs/user.md ./app/docs/user.md |
53 |
| -COPY docs/quantity_comparison_graph.svg ./app/docs/quantity_comparison_graph.svg |
54 |
| - |
55 |
| -# Set permissions so files and directories can be accessed on AWS |
56 |
| -RUN chmod 644 $(find . -type f) |
57 |
| -RUN chmod 755 $(find . -type d) |
58 |
| - |
59 |
| -# The entrypoint for AWS is to invoke the handler function within the app package |
60 |
| -CMD [ "/app/app.handler" ] |
| 1 | +FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.12 AS builder |
| 2 | + |
| 3 | +RUN pip install poetry==1.8.3 |
| 4 | + |
| 5 | +ENV POETRY_NO_INTERACTION=1 \ |
| 6 | + POETRY_VIRTUALENVS_IN_PROJECT=1 \ |
| 7 | + POETRY_VIRTUALENVS_CREATE=1 \ |
| 8 | + POETRY_CACHE_DIR=/tmp/poetry_cache |
| 9 | + |
| 10 | +COPY pyproject.toml poetry.lock ./ |
| 11 | + |
| 12 | +RUN --mount=type=cache,target=$POETRY_CACHE_DIR \ |
| 13 | + poetry install --without dev --no-root |
| 14 | + |
| 15 | +FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.12 |
| 16 | + |
| 17 | +ENV VIRTUAL_ENV=/app/.venv \ |
| 18 | + PATH="/app/.venv/bin:$PATH" |
| 19 | + |
| 20 | +COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} |
| 21 | + |
| 22 | +# Precompile python files for faster startup |
| 23 | +RUN python -m compileall -q . |
| 24 | + |
| 25 | +# Copy the evaluation function to the app directory |
| 26 | +COPY evaluation_function ./evaluation_function |
| 27 | + |
| 28 | +# Command to start the evaluation function with |
| 29 | +ENV FUNCTION_COMMAND="python" |
| 30 | + |
| 31 | +# Args to start the evaluation function with |
| 32 | +ENV FUNCTION_ARGS="-m,evaluation_function.main" |
| 33 | + |
| 34 | +# The transport to use for the RPC server |
| 35 | +ENV FUNCTION_RPC_TRANSPORT="ipc" |
| 36 | + |
| 37 | +ENV LOG_LEVEL="debug" |
0 commit comments