Build + push avatar image / build-and-push (push) Failing after 17s
gm npm wrapper shells out to the gm/convert binary on every avatar upload; the builder stage had it but the final runtime stage did not, so every upload 500'd with 'gm convert binaries can't be found'.
45 lines
1.7 KiB
Docker
45 lines
1.7 KiB
Docker
FROM alpine:3.23.4 AS builder
|
|
|
|
RUN apk update && apk upgrade && \
|
|
apk add --no-cache make gcc nodejs npm python3 g++ gcc libc-dev expat expat-dev libxml2-dev libxmlb-dev yarn gcompat \
|
|
libpq postgresql-dev nodejs-dev graphicsmagick graphicsmagick-dev nginx nginx-mod-http-headers-more && \
|
|
rm -rf /var/cache/apk/*
|
|
|
|
|
|
RUN mkdir -p /usr/share/vnc-avatar
|
|
ADD app /usr/share/vnc-avatar/app
|
|
COPY package.json /usr/share/vnc-avatar/package.json
|
|
|
|
RUN yarn global add node-gyp@9.4.0
|
|
RUN cd /usr/share/vnc-avatar && yarn install
|
|
|
|
COPY config/vnc-avatarservice.js /usr/share/vnc-avatar/config/vnc-avatarservice.js
|
|
COPY 404.html /var/www/localhost/htdocs/404.html
|
|
|
|
# Folder to store the Avatars
|
|
RUN mkdir /var/opt/out
|
|
|
|
FROM alpine:3.23.4
|
|
# graphicsmagick is required at runtime too — the gm npm wrapper shells out to the
|
|
# `gm`/`convert` binary on every upload; the builder stage has it, but the runtime
|
|
# stage does not unless we add it here.
|
|
RUN apk update && apk upgrade && apk add --no-cache nodejs yarn nginx nginx-mod-http-headers-more graphicsmagick && rm -rf /var/cache/apk/*
|
|
|
|
COPY --from=builder /usr/share/vnc-avatar /usr/share/vnc-avatar
|
|
COPY --from=builder /var/opt/out /var/opt/out
|
|
|
|
|
|
RUN addgroup -g 1001 vnc && adduser -D -u 1001 -S -G vnc vnc
|
|
# Set up necessary directories with correct permissions for the non-root user
|
|
RUN mkdir -p /var/lib/nginx/tmp /var/log/nginx /var/www/html /etc/nginx/sites-enabled && \
|
|
chown -R vnc:vnc /var/lib/nginx /var/log/nginx /var/www/html /etc/nginx/sites-enabled && \
|
|
chmod -R 755 /var/lib/nginx /var/log/nginx /var/www/html && \
|
|
chown vnc:vnc /var/opt/out
|
|
|
|
RUN mkdir -p /run/nginx/ && chown vnc:vnc /run/nginx/
|
|
|
|
|
|
USER vnc
|
|
|
|
ENTRYPOINT ["node", "/usr/share/vnc-avatar/app/app.js"]
|