Skip to content

Instantly share code, notes, and snippets.

@BananaAcid
Last active April 2, 2023 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BananaAcid/7de3603e3487dc0447af343f84ee654f to your computer and use it in GitHub Desktop.
Save BananaAcid/7de3603e3487dc0447af343f84ee654f to your computer and use it in GitHub Desktop.
KaboomJS - make replit.com export runnable (Docker, Standalone)

Note: The node_modules folder should be deleted, as it may contain incompatible module versions (not suited for your OS).

  1. Update project info, add the script block, the dependencies should stay as exported by replit (included here for completeness).

File: package.json

{
  "name": "kaboom-env", 
  "scripts": {
    "prerequesites": "npx --yes rimraf node_modules && npm install",
    
    "test": "node run.js", 
    "docker:test": "npm run prerequesites && npm test",
    
    "start": "npx http-server ./dist --port 8000",
    "docker:start": "npm run prerequesites && npm start"
  }, 
  "dependencies": {
    "@replit/database": "^2.0.2", 
    "esbuild": "^0.15.10", 
    "express": "^4.18.1", 
    "kaboom": "^2000.2.9", 
    "stacktrace-js": "^2.0.2", 
    "ws": "^8.2.0"
  }
}

can be tested by npm start

  1. add compose file: docker-compose.yaml
version: "2"
services:
  node:
    image: "node:19-alpine"
    user: "node"
    working_dir: /app
    environment:
      - NODE_ENV=production
    volumes:
      - ./:/app
    ports:
      - "8000:8000"
    expose:
      - "8000"
    command: "npm run docker:start"

can be used with docker compose up, open the browser at http://localhost:8000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment