Skip to content

Updated Dockerfile #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 61 additions & 37 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.12 AS builder

RUN pip install poetry==1.8.3

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

COPY pyproject.toml poetry.lock ./

RUN --mount=type=cache,target=$POETRY_CACHE_DIR \
poetry install --without dev --no-root

FROM ghcr.io/lambda-feedback/evaluation-function-base/python:3.12

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

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

# Precompile python files for faster startup
RUN python -m compileall -q .

# Copy the evaluation function to the app directory
COPY evaluation_function ./evaluation_function

# Command to start the evaluation function with
ENV FUNCTION_COMMAND="python"

# Args to start the evaluation function with
ENV FUNCTION_ARGS="-m,evaluation_function.main"

# The transport to use for the RPC server
ENV FUNCTION_RPC_TRANSPORT="ipc"

ENV LOG_LEVEL="debug"
# Base image that bundles AWS Lambda Python 3.8 image with some middleware functions
# FROM base-eval-tmp
# FROM rabidsheep55/python-base-eval-layer
FROM ghcr.io/lambda-feedback/baseevalutionfunctionlayer:main-3.8

RUN yum install -y git

WORKDIR /app

# Copy and install any packages/modules needed for your evaluation script.
COPY requirements.txt .
RUN pip3 install -r requirements.txt

# Copy main scripts
COPY evaluation.py ./app/
COPY evaluation_tests.py ./app/
COPY preview.py ./app/
COPY preview_tests.py ./app/

# Copy contexts
COPY context/physical_quantity.py ./app/context/
COPY context/symbolic.py ./app/context/

# Copy feedback messages
COPY feedback/physical_quantity.py ./app/feedback/
COPY feedback/symbolic.py ./app/feedback/

# Copy preview implementations
COPY preview_implementations/physical_quantity_preview.py ./app/preview_implementations/
COPY preview_implementations/symbolic_preview.py ./app/preview_implementations/

# Copy tests
COPY tests/example_tests.py ./app/tests/
COPY tests/physical_quantity_evaluation_tests.py ./app/tests/
COPY tests/physical_quantity_preview_tests.py ./app/tests/
COPY tests/slr_quantity_tests.py ./app/tests/
COPY tests/symbolic_evaluation_tests.py ./app/tests/
COPY tests/symbolic_preview_tests.py ./app/tests/

# Copy utility code
COPY utility/criteria_graph_utilities.py ./app/utility/
COPY utility/criteria_parsing.py ./app/utility/
COPY utility/evaluation_result_utilities.py ./app/utility/
COPY utility/expression_utilities.py ./app/utility/
COPY utility/physical_quantity_utilities.py ./app/utility/
COPY utility/preview_utilities.py ./app/utility/
COPY utility/slr_parsing_utilities.py ./app/utility/
COPY utility/syntactical_comparison_utilities.py ./app/utility/
COPY utility/unit_system_conversions.py ./app/utility/

# Copy Documentation
COPY docs/dev.md ./app/docs/dev.md
COPY docs/user.md ./app/docs/user.md
COPY docs/quantity_comparison_graph.svg ./app/docs/quantity_comparison_graph.svg

# Set permissions so files and directories can be accessed on AWS
RUN chmod 644 $(find . -type f)
RUN chmod 755 $(find . -type d)

# The entrypoint for AWS is to invoke the handler function within the app package
CMD [ "/app/app.handler" ]
Loading