diff --git a/Dockerfile b/Dockerfile index 855ccf9..3431310 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,23 @@ -FROM node:20.11-alpine3.18 as build +FROM node:20.11-alpine3.19 as build RUN npm install -g pnpm # Move files into the image and install WORKDIR /app COPY ./service ./ + +# Install libvips (using vips-dev to get the pkg-config files) so we can have +# sharp use it instead of its built-in version. +RUN apk add --update vips-dev + +# Packages required to build the C++ files that sharp will build to use the +# system libvips. +RUN apk add --update make gcc binutils g++ + RUN pnpm install --production --frozen-lockfile > /dev/null # Uses assets from build stage to reduce build size -FROM node:20.11-alpine3.18 +FROM node:20.11-alpine3.19 RUN apk add --update dumb-init @@ -18,6 +27,11 @@ ENTRYPOINT ["dumb-init", "--"] WORKDIR /app COPY --from=build /app /app +# Copy the libraries so libvips and the other dependecies needed by the sharp +# C++ files are available in the image. +COPY --from=build /usr/lib /usr/lib +COPY --from=build /lib /lib + EXPOSE 3000 ENV PDS_PORT=3000 ENV NODE_ENV=production