mirror of
https://github.com/zoriya/flood.git
synced 2026-06-06 12:02:13 +00:00
Dockerfile: cleanup unused files after installation
This commit is contained in:
+18
-7
@@ -18,28 +18,39 @@ RUN apk --no-cache add \
|
|||||||
python build-base
|
python build-base
|
||||||
|
|
||||||
# Fetch dependencies from npm
|
# Fetch dependencies from npm
|
||||||
RUN npm set unsafe-perm true
|
RUN npm ci --no-optional
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# Build package
|
# Build package
|
||||||
RUN cp config.cli.js config.js
|
RUN cp config.cli.js config.js
|
||||||
RUN npm run build
|
RUN npm pack
|
||||||
RUN npm pack --ignore-scripts
|
|
||||||
|
|
||||||
# Now get the clean image
|
# Now get the clean image
|
||||||
FROM ${NODE_IMAGE} as flood
|
FROM ${NODE_IMAGE} as flood
|
||||||
|
|
||||||
# Copy package built
|
# Copy package built
|
||||||
COPY --from=nodebuild /usr/src/app/*.tgz /tmp/
|
COPY --from=nodebuild /usr/src/app/flood-*.tgz /tmp/
|
||||||
|
|
||||||
# Install package
|
# Install package
|
||||||
RUN npm i -g /tmp/*.tgz --unsafe-perm
|
RUN npm i -g /tmp/flood-*.tgz
|
||||||
RUN rm /tmp/*.tgz
|
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
mediainfo
|
mediainfo
|
||||||
|
|
||||||
|
# Remove temporary files and caches
|
||||||
|
RUN rm -rf /tmp/* /root/*
|
||||||
|
|
||||||
|
# Cleanups below are destructive
|
||||||
|
# Let the maintainer know if there is a usecase that requires extension to this image
|
||||||
|
|
||||||
|
# Remove apk, npm and yarn
|
||||||
|
RUN rm -rf /lib/apk /sbin/apk
|
||||||
|
RUN rm -rf /usr/local/lib/node_modules/npm
|
||||||
|
RUN rm -rf /opt/*
|
||||||
|
|
||||||
|
# Remove Node.js development files
|
||||||
|
RUN rm -rf /usr/local/include/node
|
||||||
|
|
||||||
# Create "download" user
|
# Create "download" user
|
||||||
RUN adduser -h /home/download -s /sbin/nologin --disabled-password download
|
RUN adduser -h /home/download -s /sbin/nologin --disabled-password download
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user