diff --git a/docker/Dockerfile b/docker/Dockerfile index 953cb4f52c..3b5f2f1bc4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ ARG TARGET ARG VERSION ARG BUILD_DATE -FROM $TARGET/node:18-alpine +FROM ${TARGET}/node:18-slim LABEL \ org.label-schema.build-date=$BUILD_DATE \ @@ -11,23 +11,37 @@ LABEL \ COPY qemu-* /usr/bin/ # System dependencies -RUN apk add --no-cache tzdata nmap ffmpeg sqlite openssl gzip eudev gcompat +RUN apt-get update && apt-get install -y \ + tzdata \ + nmap \ + ffmpeg \ + sqlite3 \ + openssl \ + gzip \ + udev \ + bluez \ + && rm -rf /var/lib/apt/lists/* WORKDIR /tmp -# Install Bluez dependencies -RUN apk add --no-cache bluez - # Install Gladys RUN mkdir /src WORKDIR /src ADD . /src COPY ./static /src/server/static WORKDIR /src/server -RUN apk add --no-cache --virtual .build-deps make gcc g++ python3 py3-setuptools git libffi-dev linux-headers libc6-compat \ - && npm ci --unsafe-perm --production \ - && npm cache clean --force \ - && apk del .build-deps + +# Install build dependencies and application dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + python3 \ + python3-pip \ + git \ + libffi-dev \ + && npm ci --unsafe-perm --production \ + && npm cache clean --force \ + && apt-get purge -y --auto-remove \ + && rm -rf /var/lib/apt/lists/* ENV NODE_ENV production ENV SERVER_PORT 80 @@ -35,4 +49,4 @@ ENV SERVER_PORT 80 # Export listening port EXPOSE 80 -CMD ["node", "index.js"] +CMD ["node", "index.js"] \ No newline at end of file diff --git a/docker/Dockerfile.buildx b/docker/Dockerfile.buildx index 6c86797a45..d4117cab81 100644 --- a/docker/Dockerfile.buildx +++ b/docker/Dockerfile.buildx @@ -1,28 +1,27 @@ # STEP 1 # Prepare server package*.json files -FROM node:18-alpine as json-files +FROM node:18-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:18-alpine as gladys +FROM node:18-slim as gladys # System dependencies -RUN apk add --no-cache \ +RUN apt-get update && apt-get install -y \ tzdata \ nmap \ ffmpeg \ - sqlite \ + sqlite3 \ openssl \ gzip \ - eudev \ - gcompat \ - bluez + udev \ + bluez \ + && rm -rf /var/lib/apt/lists/* COPY --from=json-files /json-files/server /src/server @@ -30,10 +29,17 @@ ENV LD_LIBRARY_PATH /lib WORKDIR /src/server -RUN apk add --no-cache --virtual .build-deps make gcc g++ python3 py3-setuptools git libffi-dev linux-headers \ - && npm ci --unsafe-perm --production \ - && npm cache clean --force \ - && apk del .build-deps +# Install build dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + python3 \ + python3-pip \ + git \ + libffi-dev \ + && npm ci --unsafe-perm --production \ + && npm cache clean --force \ + && apt-get purge -y --auto-remove \ + && rm -rf /var/lib/apt/lists/* # Copy builded front COPY ./static /src/server/static