Skip to content

Commit

Permalink
/deploy sit
Browse files Browse the repository at this point in the history
  • Loading branch information
sliu008 committed Jan 7, 2025
1 parent 31318c1 commit 980f431
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64
platforms: linux/arm/v7
build-args: |
DIST_PATH: ${{ contains(github.event.head_commit.message, '/deploy') && 'dist/' || '' }}
SOURCE: ${{ env.local_forge_py != '' && env.local_forge_py || format('{0}=={1}', needs.build.outputs.pyproject_name, needs.build.outputs.version) }}
31 changes: 18 additions & 13 deletions docker/lambdaDockerfileArm
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
# Use the AWS Lambda base image for Python 3.11 (ARM64 architecture)
FROM public.ecr.aws/lambda/python:3.11-arm64

# Global build arguments
# Global build arguments and environment variables
ARG SOURCE
ARG DIST_PATH=dist/
ENV LAMBDA_TASK_ROOT=/var/task

# Install required packages
RUN yum -q -y install gcc || microdnf install gcc
# Install required packages and cleanup in a single layer to reduce image size
RUN yum -q -y install gcc && \
# Install dependencies
pip3 install awslambdaric --target $LAMBDA_TASK_ROOT && \
# Copy and install the package
mkdir -p $DIST_PATH && \
pip3 install --no-cache-dir --force \
--index-url https://pypi.org/simple/ \
--extra-index-url https://test.pypi.org/simple/ \
--target $LAMBDA_TASK_ROOT $SOURCE && \
# Cleanup to reduce image size
yum -y remove gcc && \
yum clean all && \
rm -rf /var/cache/yum && \
rm -rf $DIST_PATH

# Copy the distribution package into the container
# Copy any distribution files (if needed)
COPY $DIST_PATH $DIST_PATH

# Install dependencies into the Lambda task root
RUN pip3 install awslambdaric --target $LAMBDA_TASK_ROOT \
&& pip3 install --no-cache-dir --force --index-url https://pypi.org/simple/ \
--extra-index-url https://test.pypi.org/simple/ --target $LAMBDA_TASK_ROOT $SOURCE

# Remove the distribution files to reduce image size
RUN rm -rf $DIST_PATH

# Lambda entry point and handler
ENTRYPOINT []
CMD ["podaac.lambda_handler.lambda_handler.handler"]
CMD ["podaac.lambda_handler.lambda_handler.handler"]

0 comments on commit 980f431

Please sign in to comment.