Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions infrastructure/instance/mesh_processor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ resource "aws_ecr_repository" "mesh_file_converter_lambda_repository" {
module "mesh_processor_docker_image" {
count = var.create_mesh_processor ? 1 : 0

source = "terraform-aws-modules/lambda/aws//modules/docker-build"
version = "8.1.2"
source = "terraform-aws-modules/lambda/aws//modules/docker-build"
version = "8.1.2"
docker_file_path = "./mesh_processor/Dockerfile"

create_ecr_repo = false
ecr_repo = aws_ecr_repository.mesh_file_converter_lambda_repository[0].name
Expand All @@ -57,9 +58,10 @@ module "mesh_processor_docker_image" {

platform = "linux/amd64"
use_image_tag = false
source_path = local.mesh_processor_lambda_dir
source_path = abspath("${path.root}/../../lambdas")
triggers = {
dir_sha = local.mesh_processor_lambda_dir_sha
dir_sha = local.mesh_processor_lambda_dir_sha
shared_dir_sha = local.shared_dir_sha
}
}

Expand Down
22 changes: 18 additions & 4 deletions lambdas/mesh_processor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,31 @@ RUN mkdir -p /home/appuser && \
echo 'appuser:x:1001:' >> /etc/group && \
chown -R 1001:1001 /home/appuser && pip install "poetry~=2.1.2"

# Install Poetry dependencies
# Copy mesh_processor Poetry files
COPY ./mesh_processor/poetry.lock ./mesh_processor/pyproject.toml ./mesh_processor/README.md ./


COPY poetry.lock pyproject.toml README.md ./
# Install mesh_processor dependencies
WORKDIR /var/task
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main


# -----------------------------
FROM base AS build

COPY src .
# Set working directory back to Lambda task root
WORKDIR /var/task

# Copy shared source code
COPY ./shared/src/common ./common

# Copy mesh_processor source code
COPY ./mesh_processor/src .

# Set correct permissions
RUN chmod 644 $(find . -type f) && chmod 755 $(find . -type d)

# Switch to the non-root user for running the container
USER 1001:1001

# Set the Lambda handler
CMD ["converter.lambda_handler"]