Skip to content

Commit

Permalink
Merge pull request #61 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 b6e78a1 + 55a5e0b commit a2d27ff
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 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.9 and ZIP
RUN dnf install -y python3.9 python3.9-pip zip && \
# Install Python 3.9, pip, and other necessary tools
RUN dnf install -y python3.9 python3.9-pip zip python3.9-venv && \
dnf clean all

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

# Install application and dependencies into a directory named 'python'
RUN python3.9 -m pip install --upgrade pip && \
python3.9 -m pip install . --target python && \
python3.9 -m pip install -r requirements.txt --target python
# Create and activate a virtual environment, then install dependencies
RUN python3.9 -m venv /root/venv && \
. /root/venv/bin/activate && \
pip install --upgrade pip && \
pip install . && \
pip install -r requirements.txt && \
deactivate

# Package everything into a ZIP file
CMD ["zip", "-r", "layer.zip", "python"]
CMD . /root/venv/bin/activate && \
mkdir python && \
pip install . -t python && \
pip install -r requirements.txt -t python && \
zip -r layer.zip python && \
deactivate

0 comments on commit a2d27ff

Please sign in to comment.