Skip to content

Commit 614964e

Browse files
committed
updates to the readme, inclusion of both x64 and arm64 - debug
1 parent 7883113 commit 614964e

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

Dockerfile

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1-
# Use Amazon Linux 2 base image explicitly
2-
FROM amazonlinux:2
1+
# Stage 1: Build dependencies
2+
FROM amazonlinux:2 AS builder
33

4-
# Install Node.js 20 (to match AWS Lambda runtime)
5-
RUN curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - && \
6-
yum install -y nodejs && \
7-
npm install -g npm@latest
8-
9-
WORKDIR /build
10-
11-
# Declare build arguments
12-
ARG TARGET_ARCH
13-
ARG TARGET_PLATFORM=linux
14-
15-
# Install build dependencies for sharp and libvips
4+
# Install dependencies for libvips
165
RUN yum update -y && \
176
yum install -y gcc-c++ make python3 pkgconf tar gzip && \
187
# Install libvips and its dependencies
198
yum install -y libvips libvips-devel && \
209
# Clean up to reduce layer size
2110
yum clean all && rm -rf /var/cache/yum
2211

12+
# Stage 2: Final image
13+
FROM public.ecr.aws/lambda/nodejs:20
14+
15+
WORKDIR /build
16+
17+
# Copy libvips libraries from builder stage
18+
COPY --from=builder /usr/lib64/libvips*.so* /usr/lib64/
19+
COPY --from=builder /usr/lib64/libglib-2.0*.so* /usr/lib64/
20+
COPY --from=builder /usr/lib64/libgobject-2.0*.so* /usr/lib64/
21+
COPY --from=builder /usr/lib64/libgmodule-2.0*.so* /usr/lib64/
22+
COPY --from=builder /usr/lib64/libffi*.so* /usr/lib64/
23+
24+
# Declare build arguments
25+
ARG TARGET_ARCH
26+
ARG TARGET_PLATFORM=linux
27+
2328
# Verify build environment
2429
RUN echo "Building for architecture: ${TARGET_ARCH}" && \
2530
echo "Target platform: ${TARGET_PLATFORM}"

0 commit comments

Comments
 (0)