Skip to content

Commit

Permalink
Merge pull request #63 from rhettre/feature/release-workflow
Browse files Browse the repository at this point in the history
Update Dockerfile
  • Loading branch information
rhettre authored Jul 27, 2024
2 parents c365969 + c51d2bc commit 59c96ec
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use the Amazon Linux 2023 image compatible with AWS Lambda
FROM amazonlinux:2023

# Install Python 3, pip, and other necessary tools
RUN dnf install -y python3 python3-pip zip && \
# Install Python 3.9 and other necessary tools
RUN dnf install -y python3.9 python3.9-pip zip && \
dnf clean all

# Set up the work directory
Expand All @@ -11,18 +11,30 @@ WORKDIR /root
# Copy your application code and requirements.txt into the Docker image
COPY . .

# Create and activate a virtual environment, then install dependencies
RUN python3 -m venv /root/venv && \
# Create a virtual environment and install dependencies
RUN python3.9 -m venv /root/venv && \
. /root/venv/bin/activate && \
pip install --upgrade pip && \
pip install \
--platform manylinux2014_x86_64 \
--implementation cp \
--python-version 3.9 \
--only-binary=:all: --upgrade \
-r requirements.txt && \
pip install . && \
pip install -r requirements.txt && \
deactivate

# Package everything into a ZIP file
CMD . /root/venv/bin/activate && \
mkdir python && \
pip install . -t python && \
pip install -r requirements.txt -t python && \
zip -r layer.zip python && \
mkdir -p python/lib/python3.9/site-packages && \
pip install \
--platform manylinux2014_x86_64 \
--implementation cp \
--python-version 3.9 \
--only-binary=:all: --upgrade \
-r requirements.txt -t python/lib/python3.9/site-packages && \
pip install . -t python/lib/python3.9/site-packages && \
cd python && \
zip -r ../layer.zip . && \
cd .. && \
deactivate

0 comments on commit 59c96ec

Please sign in to comment.