From 63d417f968225bbb93aad2544282bd8ef3555662 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Fri, 15 Jan 2021 20:07:18 +0800 Subject: [PATCH] Dockerfile: get rid of native build tools and fix up multi-arch --- Dockerfile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 27a0c43f..941fa386 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,24 +9,32 @@ ARG BUILDPLATFORM=amd64 ARG NODE_IMAGE=node:alpine -FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} +FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} as nodebuild WORKDIR /usr/src/app/ # Copy project files COPY . ./ -# Install dependencies -RUN apk --no-cache add \ - python build-base mediainfo - # Fetch dependencies from npm -RUN npm ci --no-optional && npm cache clean --force +RUN npm ci --no-optional # Build assets RUN cp config.cli.js config.js RUN npm run build-assets +# Now get the clean Node.js image +FROM ${NODE_IMAGE} as flood + +WORKDIR /usr/src/app/ + +# Copy sources +COPY --from=nodebuild /usr/src/app ./ + +# Install runtime dependencies +RUN apk --no-cache add \ + mediainfo + # Create "download" user RUN adduser -h /home/download -s /sbin/nologin --disabled-password download