Skip to content

Commit

Permalink
Lock image to alpine 3.17
Browse files Browse the repository at this point in the history
`musl` in Alpine 3.18 has breaking changes in sharp. We need sharp 0.32.6, but Lemmy uses 0.32.4. And even if we changed sharp to 0.32.6, livips 8.15 is not available without Alpine edge.

This change to Alpine 3.17 will hopefully fix build issues
  • Loading branch information
ubergeek77 authored Oct 7, 2023
1 parent 7b2deb1 commit 0debe8a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Dockerfile-frontend
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ RUN cd /app && \
CGO_ENABLED=0 go build

# Original Dockerfile below (mostly)
FROM node:alpine as builder

# Lemmy uses a bleeding edge version of vips, and the necessary version is only available in Alpine edge
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories && \
echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
FROM node:alpine3.17 as builder

# Added vips-dev and pkgconfig so that local vips is used instead of prebuilt
# Done for two reasons:
# - libvips binaries are not available for ARM32
# - It can break depending on the CPU (https://github.com/LemmyNet/lemmy-ui/issues/1566)
RUN apk update && apk upgrade && apk add --no-cache curl yarn python3 build-base gcc wget git vips-dev pkgconfig
RUN apk update && apk add --no-cache curl yarn python3 build-base gcc wget git vips-dev pkgconfig

# Install node-gyp
RUN npm install -g node-gyp
Expand Down Expand Up @@ -63,12 +59,8 @@ RUN rm -rf ./node_modules/npm

RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*'

FROM node:alpine as runner
# Lemmy uses a bleeding edge version of vips, and the necessary version is only available in Alpine edge
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories && \
echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories

RUN apk update && apk upgrade && apk add vips-cpp
FROM node:alpine3.17 as runner
RUN apk add vips-cpp
COPY --from=builder /usr/src/app/dist /app/dist
COPY --from=builder /usr/src/app/node_modules /app/node_modules

Expand Down

0 comments on commit 0debe8a

Please sign in to comment.