From 10f648b7cdfc633bff2d9ff906072cdb611ad92d Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Sun, 14 Jul 2024 14:06:40 +0200 Subject: [PATCH] Reduce image size by switching to alpine and excluding folders from being copied into the image --- .dockerignore | 14 +++++++++++--- Dockerfile | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1b733041..d7e7b41f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,13 @@ -node_modules .github .git* - -*.md \ No newline at end of file +.idea +dev +docs +licenses +node_modules +pairdrop-cli +*.md +*.yml +Dockerfile +rtc_config_example.json +turnserver_example.conf \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 43c97acb..23496e52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM node:lts-alpine +FROM alpine:latest WORKDIR /home/node/app COPY package*.json ./ -RUN npm ci +RUN apk add --no-cache nodejs npm +RUN NODE_ENV="production" npm ci --omit=dev +# Directories and files excluded via .dockerignore COPY . . # environment settings