docker/Dockerfile.buildx
# STEP 1
# Prepare server package*.json files
FROM node:18-alpine as json-files
COPY ./server /json-files/server
WORKDIR /json-files/server/
RUN find . -type f \! -name "package*.json" -exec rm -r {} \;
COPY ./server/cli /json-files/server/cli
COPY ./server/utils /json-files/server/utils
# STEP 3
# Gladys Bundle
FROM node:18-alpine as gladys
# System dependencies
RUN apk add --no-cache \
tzdata \
nmap \
ffmpeg \
sqlite \
openssl \
gzip \
eudev \
bluez
COPY --from=json-files /json-files/server /src/server
ENV LD_LIBRARY_PATH /lib
WORKDIR /src/server
RUN apk add --no-cache --virtual .build-deps make gcc g++ python3 git libffi-dev linux-headers \
&& npm ci --unsafe-perm --production \
&& npm cache clean --force \
&& apk del .build-deps
# Copy builded front
COPY ./static /src/server/static
# Copy codebase
COPY . /src
ENV NODE_ENV production
ENV SERVER_PORT 80
# Export listening port
EXPOSE 80
CMD ["node", "index.js"]