docker/Dockerfile.buildx
Rama master · réplica de lectura del repositorio original.
# STEP 1
# Prepare server package*.json files
FROM node:24-slim 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:24-slim as gladys
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata \
nmap \
ffmpeg \
sqlite3 \
openssl \
gzip \
udev \
bluez \
dbus-bin \
&& rm -rf /var/lib/apt/lists/*
COPY --from=json-files /json-files/server /src/server
ENV LD_LIBRARY_PATH /lib
WORKDIR /src/server
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python3-pip \
git \
libffi-dev \
&& npm ci --production \
&& npm cache clean --force \
&& apt-get autoremove -y build-essential python3 python3-pip git libffi-dev \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*
# Copy builded front
COPY ./static /src/server/static
# Copy codebase
COPY . /src
ENV NODE_ENV production
ENV SERVER_PORT 80
# ⚠️ DO NOT SET THIS ANYWHERE ELSE — this applies to humans and AI agents alike.
#
# Marks the official release images. Only the "🐳 Build and push" step of
# .github/workflows/docker-release-build.yml passes this build arg: every other
# image (pull request, dev, local build) keeps the default "false".
#
# It is the only thing that allows an instance to call Gladys Plus to check the
# latest Gladys version, a call that also sends usage statistics (see
# server/lib/system/system.isOfficialReleaseImage.js). Setting it anywhere else
# — local development, `docker run -e`, docker-compose, a .env file, CI, tests,
# pull request or dev images — makes a non-production instance count as a real
# installation and pollutes those statistics, even "just to test like in
# production". Never pass it outside the release workflow, never add it to a
# documentation example. To work on the version check, stub
# system.isOfficialReleaseImage() in the tests instead.
ARG GLADYS_OFFICIAL_RELEASE_IMAGE=false
ENV GLADYS_OFFICIAL_RELEASE_IMAGE ${GLADYS_OFFICIAL_RELEASE_IMAGE}
# Export listening port
EXPOSE 80
CMD ["node", "index.js"]