FROM node:lts-alpine

ARG SOURCE_DIR=/src
ARG ARTIFACT_DIR=/jellyfin-web

RUN apk add autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python3

WORKDIR ${SOURCE_DIR}
COPY . .

RUN npm ci --no-audit --unsafe-perm \
 && npm run build:production \
 && mv dist ${ARTIFACT_DIR}
