henrywhitaker3 / Speedtest-Tracker

Continuously track your internet speed
GNU General Public License v3.0
1.52k stars 121 forks source link

[Feature Request] Cull the node_modules folder in the docker image. #744

Open Unrepentant-Atheist opened 2 years ago

Unrepentant-Atheist commented 2 years ago

Are 22+k ( https://i.imgur.com/08Y7Eta.png ) files really necessary in the www/node_modules after I did a docker compose? Can't it be culled to include only the necessary parts for the app to work?

It's a PITA to back it up with Macrium Reflect.

packages.json says:

    "dependencies": {
        "@babel/plugin-proposal-class-properties": "^7.13.0",
        "chart.js": "^2.9.4",
        "csv-file-validator": "^1.10.1",
        "js-cookie": "^2.2.1",
        "react-beautiful-dnd": "^13.1.0",
        "react-bootstrap": "^1.5.1",
        "react-chartjs-2": "^2.11.1",
        "react-router": "^5.2.0",
        "react-router-dom": "^5.2.0",
        "react-toastify": "^7.0.3"
    }

yet the image is pulling 742 different modules with 22k+ files and putting them in the data folder.

This is the docker-compose.yml I use:

version: '3.3'
services:
    speedtest:
        container_name: speedtest
        image: henrywhitaker3/speedtest-tracker
        ports:
            - 8765:80
        volumes:
            - /volume1/docker/speedtest:/config
        environment:
            - TZ=xxx
            #- PGID=
            #- PUID=
            - OOKLA_EULA_GDPR=true
        labels:
            - deunhealth.restart.on.unhealthy=true
        logging:
            driver: "json-file"
            options:
                max-file: "10"
                max-size: "1024k"
        restart: always
networks:
  default:
    name: dockernet
    external: true
agneevX commented 2 years ago

As a temporary fix, you can put them in a tmpfs (if you've got enough memory):

  tmpfs:
    - /config/www/node_modules:size=400m
Unrepentant-Atheist commented 2 years ago

Das bueno!

And even more with

environment:
            - NODE_ENV=production
jimmybrancaccio commented 2 years ago

https://www.reddit.com/r/selfhosted/comments/q9hmll/why_does_the_speedtesttracker_need_gazillion_of/

agneevX commented 2 years ago

The main issue is that the entire image is copied to the /config folder instead of being read from the image directly.