services: portfolio: # SPOT: IMAGE_NAME comes from .env (see env.example). No default — # an empty tag would have compose fall back to `portfolio-portfolio` # silently, which `make run-dev` would then fail to find. image: ${IMAGE_NAME:?IMAGE_NAME must be set in .env (see env.example)} build: context: . dockerfile: Dockerfile container_name: portfolio ports: - "${PORT:?PORT must be set in .env (see env.example)}:${PORT:?PORT must be set in .env (see env.example)}" env_file: - .env volumes: - ./app:/app - node_modules:/app/node_modules - vendor:/app/static/vendor # Run `npm install` on every container start so the named volumes # reflect the current package.json (postinstall regenerates vendor/). command: sh -c "npm install --prefix /app --no-audit --no-fund && python app.py" restart: unless-stopped volumes: node_modules: vendor: