Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use system libvips instead of pre-built one. #167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down