josephg-sharejs
SUCCESS
23m 51s
History Source
SummaryIterations1Transcript22Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile377 bytes written
text21 lines · 377 chars
FROM node:slim

# Create app directory
WORKDIR /app

# Install dependencies (including devDependencies to satisfy build)
COPY package.json package-lock.json* ./
RUN npm install

# Copy the rest of the source
COPY . .

# Build from source
RUN npm run build

# Expose port for the simple static server
EXPOSE 3000

# Start server that serves built dist
CMD ["node", "server.js"]
VERIFYVerifyBuild· step #2
1m 14s
VerifyBuildbuild_failed
Build error
- Exact error message and exit code
  - sh: 1: make: not found
  - npm error code 127
  - The build reports: “process ... npm install did not complete successfully: exit code: 127”

- Failing command/step
  - [4/6] RUN npm install
  - Under this step, npm runs the prepublish script of share@0.7.40, which executes make and fails: “> share@0.7.40 prepublish” followed by “> make”.

- Missing packages or files mentioned
  - make tool is not installed in the base image (node:slim), causing the npm install to fail.

- Version mismatch/info
  - npm reports a patch update: New patch version of npm available! 11.11.0 -> 11.11.1

- Context highlights from Dockerfile
  - COPY package.json package-lock.json* ./
  - RUN npm install
  - The failure occurs because the prepublish step for a dependency requires make, which isn’t present.
WRITEWriteFile· step #3
0s
Dockerfile539 bytes written
text25 lines · 539 chars
FROM node:slim

# Install build tools required for npm install prepublish script
RUN apt-get update \
  && apt-get install -y --no-install-recommends build-essential \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install dependencies (including devDependencies for build)
COPY package.json ./
RUN npm install

# Copy the rest of the source
COPY . ./

# Build from source
RUN npm run build

# Expose a port for the static server we provide
EXPOSE 3000

# Start the static file server that serves built assets
CMD ["node", "server.js"]
VERIFYVerifyBuild· step #4
1m 38s
VerifyBuildbuild_failed
Build error
Summary of Docker build error

- Exact error message and exit code
  - make: *** No targets specified and no makefile found.  Stop.
  - npm error code 2
  - A complete log of this run can be found in: /root/.npm/_logs/2026-03-17T23_02_36_651Z-debug-0.log
  - Exit code: 2

- Failing command/step
  - [5/7] RUN npm install
  - Inside this step, npm install runs a prepublish script that executes make, which fails due to the missing Makefile:
    - Prepublish script: share@0.7.40 prepublish
    - Command attempted: make

- Missing packages or files mentioned
  - No Makefile present in /app (missing Makefile needed by the prepublish script)
  - The failure arises because the prepublish script attempts to run make without a Makefile

- Version mismatch/info
  - Base image: node:slim (digest shown in Dockerfile)
  - npm reports a patch update available: New patch version of npm available! 11.11.0 -> 11.11.1
  - (No explicit Node version mismatch noted; the issue is the missing Makefile invoked by the prepublish script.)
WRITEWriteFile· step #5
0s
Dockerfile747 bytes written
text29 lines · 747 chars
FROM node:slim

# Install build tools required for npm install prepublish script
RUN apt-get update \
  && apt-get install -y --no-install-recommends build-essential python ca-certificates \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy essential files first to satisfy prepublish hooks
COPY Makefile .
COPY package.json .
COPY package-lock.json* ./

# Install dependencies (including devDependencies for build)
RUN npm install

# Copy the rest of the source
COPY . .

# Build from source
RUN npm run build

# Expose a port for any potential server (dist is generated under dist/)
EXPOSE 3000

# Default command: print a simple readiness message
CMD ["node", "-e", "console.log('ShareJS build container ready. dist ready at /app/dist')"]
VERIFYVerifyBuild· step #6
1m 12s
VerifyBuildbuild_failed
Build error
- Failing step (failing command/step):
  [2/9] RUN apt-get update   && apt-get install -y --no-install-recommends build-essential python ca-certificates   && rm -rf /var/lib/apt/lists/*

- Exact error message and exit code:
  3.403 Package 'python' is not available, but is referred to by another package.
  3.403 This may mean that the package is missing, has been obsoleted, or
  3.403 is only available from another source
  3.403 However the following packages replace it:
  3.403   python-is-python3 2to3
  3.403 
  3.405 E: Package 'python' has no installation candidate
  ------
  Dockerfile:4
  --------------------
     3 |     # Install build tools required for npm install prepublish script
     4 | >>> RUN apt-get update \
     5 | >>>   && apt-get install -y --no-install-recommends build-essential python ca-certificates \
     6 | >>>   && rm -rf /var/lib/apt/lists/*
     7 |     
  --------------------
  ERROR: failed to build: failed to solve: process "/bin/sh -c apt-get update   && apt-get install -y --no-install-recommends build-essential python ca-certificates   && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100

- Missing packages or files mentioned:
  - Package 'python' is not available
  - Replacement shown: 'python-is-python3' (with 2to3)

- Version mismatch / context notes:
  - Base image uses node:slim on Debian bookworm (as indicated by apt sources), where the traditional 'python' package is not available.
  - The message indicates Python 2-era package removal and suggests using Python 3 alias: 'python-is-python3'.
WRITEWriteFile· step #7
0s
Dockerfile1815 bytes written
text78 lines · 1815 chars
FROM node:slim

# Install build tools and Python3 (via python-is-python3) to satisfy prepublish hook
RUN apt-get update \
  && apt-get install -y --no-install-recommends build-essential python3 python-is-python3 ca-certificates \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy package manifests first to leverage docker cache
COPY package.json package-lock.json* ./

RUN npm install

# Copy the rest of the source
COPY . .

# Build from source
RUN npm run build

# Create a tiny static file server to serve the built assets
RUN cat > /app/server.js << "JS"
const http = require("http");
const path = require("path");
const fs = require("fs");

const distDir = path.resolve(__dirname, "dist");

const mime = {
  ".js": "application/javascript",
  ".css": "text/css",
  ".html": "text/html",
  ".json": "application/json",
  ".png": "image/png",
  ".jpg": "image/jpeg",
  ".jpeg": "image/jpeg",
  ".gif": "image/gif",
  ".svg": "image/svg+xml"
};

function serve(filePath, res) {
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end("Not found");
      return;
    }
    const ext = path.extname(filePath);
    const type = mime[ext] || "application/octet-stream";
    res.setHeader("Content-Type", type);
    res.end(data);
  });
}

const server = http.createServer((req, res) => {
  let reqPath = req.url.split("?")[0];
  if (reqPath === "/") reqPath = "/index.html";
  const filePath = path.join(distDir, reqPath);
  fs.access(filePath, fs.constants.F_OK, (err) => {
    if (err) {
      res.statusCode = 404;
      res.end("Not found");
    } else {
      serve(filePath, res);
    }
  });
});

const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log("Serving dist/ at port", PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #8
2m 27s
VerifyBuildbuild_failed
Build error
- Exact error message and exit code
  - make: *** No targets specified and no makefile found.  Stop.
  - npm error code 2
  - process "/bin/sh -c npm install" did not complete successfully: exit code: 2

- Failing command/step
  - [5/8] RUN npm install

- Missing packages or files mentioned
  - The failure occurs because there is no Makefile in the project directory, causing the prepublish script (shared as share@0.7.40 prepublish) to fail when it runs make:
    - "No targets specified and no makefile found." This indicates a missing Makefile or targets for the make invocation.

- Version mismatch information
  - No version mismatch reported. There is a patch update notice: "New patch version of npm available! 11.11.0 -> 11.11.1" but no mismatch between tool versions is cited.
WRITEWriteFile· step #9
0s
Dockerfile755 bytes written
text32 lines · 755 chars
FROM node:slim

# Install make (needed for the prepublish build step) and minimal tooling
RUN apt-get update \
  && apt-get install -y --no-install-recommends make ca-certificates \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy manifest files first so npm install can rely on them and run prepublish (make)
COPY Makefile ./
COPY package.json ./
COPY package-lock.json* ./

# Install dependencies (including devDependencies for build)
RUN npm install

# Copy the rest of the source code
COPY . ./

# Build from source (dist will be placed under dist/)
RUN npm run build

# Simple Node.js static-like server to serve built assets from dist/
RUN writefile

# Expose port for the server
EXPOSE 3000

# Start the server
CMD ["node", "/app/server.js"]
WRITEWriteFile· step #10
0s
Dockerfile1701 bytes written
text68 lines · 1701 chars
FROM node:slim

# Install build tooling needed for npm install prepublish and building
RUN apt-get update \
  && apt-get install -y --no-install-recommends make ca-certificates \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy manifest files first to ensure npm install can run prepublish (which may call make)
COPY Makefile ./
COPY package.json ./

# Install dependencies (devDependencies included for the build)
RUN npm install

# Copy the rest of the source code
COPY . ./

# Build from source (dist will be generated in dist/)
RUN npm run build

# Create a small static HTTP server to serve dist/
RUN cat > /app/server.js << 'JS'
const http = require('http');
const path = require('path');
const fs = require('fs');

const distDir = path.resolve(__dirname, 'dist');

function serve(req, res) {
  let url = req.url.split('?')[0];
  if (url === '/') url = '/index.html';
  const filePath = path.join(distDir, url);
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end('Not found');
      return;
    }
    const ext = path.extname(filePath);
    const mime = {
      '.js': 'application/javascript',
      '.css': 'text/css',
      '.html': 'text/html',
      '.json': 'application/json',
      '.png': 'image/png',
      '.jpg': 'image/jpeg',
      '.jpeg': 'image/jpeg',
      '.gif': 'image/gif',
      '.svg': 'image/svg+xml'
    };
    res.setHeader('Content-Type', mime[ext] || 'application/octet-stream');
    res.end(data);
  });
}

const server = http.createServer(serve);
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log('Serving dist/ on port', PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #11
2m 09s
VerifyBuildbuild_failed
Build error
Summary:

- Failing step (Docker build): RUN npm install (step [6/9])
- Exact error message and stack trace:
  Error: Cannot find module '/app/lib/client/index.js' from '/app'
     at /app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
     at load (/app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
     at onex (/app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
     at /app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
     at FSReqCallback.oncomplete (node:fs:190:21)
- Missing file mentioned: /app/lib/client/index.js
- Exit code: 2 (npm install exit code)
- Context: The error occurs during the prepublish step invoked by npm install:
  "share@0.7.40 prepublish" -> "make" -> "node_modules/.bin/browserify -s sharejs lib/client/index.js -o dist/share.js" fails due to the missing module above.
- Version/compatibility note: No explicit version mismatch indicated. The build uses the base image node:slim; no mismatch reported.
WRITEWriteFile· step #12
0s
Dockerfile1711 bytes written
text69 lines · 1711 chars
FROM node:slim

# Install build tools and Python (Python 3 alias) for npm install prepublish hooks
RUN apt-get update \
  && apt-get install -y --no-install-recommends make ca-certificates python3 python-is-python3 \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy manifest files first so npm install can run prepublish (which may call make)
COPY Makefile ./
COPY package.json ./
COPY package-lock.json* ./

# Copy the rest of the repository
COPY . ./

# Install dependencies (including devDependencies for build)
RUN npm install

# Build from source (dist will be generated in dist/)
RUN npm run build

# Create a small static HTTP server to serve dist/
RUN cat > /app/server.js << 'JS'
const http = require('http');
const path = require('path');
const fs = require('fs');

const distDir = path.resolve(__dirname, 'dist');
const mime = {
  '.js': 'application/javascript',
  '.css': 'text/css',
  '.html': 'text/html',
  '.json': 'application/json',
  '.png': 'image/png',
  '.jpg': 'image/jpeg',
  '.jpeg': 'image/jpeg',
  '.gif': 'image/gif',
  '.svg': 'image/svg+xml'
};

function serve(req, res) {
  let url = req.url.split('?')[0];
  if (url === '/') url = '/index.html';
  const filePath = path.join(distDir, url);
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end('Not found');
      return;
    }
    const ext = path.extname(filePath);
    res.setHeader('Content-Type', mime[ext] || 'application/octet-stream');
    res.end(data);
  });
}

const server = http.createServer(serve);
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log('Serving dist/ on port', PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #13
2m 55s
VerifyBuildbuild_failed
Concerns
- Build may fail if Makefile is missing or the prepublish hook invoked by npm install relies on make; ensure Makefile exists and is compatible
- The base image node:slim is valid; consider security updates and whether additional runtime dependencies are needed for production

Build error
- Failing command/step: [ 8/10] RUN npm install (part of the build, invoking the Makefile prepublish step which runs make)
- Exact error message and exit code:
  - Parse error at dist/share.js:3966,13
  - getLength() { return getSnapshot().length },
  - SyntaxError: Unexpected token: punc (()
  - at JS_Parse_Error.get (eval at <anonymous> (/app/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)
  - at /app/node_modules/uglify-js/bin/uglifyjs:384:40
  - at time_it (/app/node_modules/uglify-js/bin/uglifyjs:620:15)
  - at /app/node_modules/uglify-js/bin/uglifyjs:345:9
  - at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)
  - Make: *** [Makefile:13: minify] Error 1
  - npm error code 2
  - process "/bin/sh -c npm install" did not complete successfully: exit code: 2
  - A complete log of this run can be found in: /root/.npm/_logs/2026-03-17T23_12_44_733Z-debug-0.log

Failing step context
- Dockerfile step 19: RUN npm install
- This triggers the Makefile target (prepublish) which runs minification (browserify/uglifyjs)

Missing packages or files mentioned
- No missing packages/files reported. Error occurs during minification of dist/share.js produced during the build.

Version mismatch / compatibility notes
- The build uses node:slim image (sha256:44bcbf493408a824104e74976ae5539f596c46cbe75ed0423a137552a555e2de)
- The failure is due to a syntax construct in dist/share.js that uglify-js cannot parse (likely ES6 syntax not supported by the minifier in use). This points to a compatibility/version issue between source/minifier and features in dist/share.js.
- npm patch update notice: New patch version available: 11.11.0 -> 11.11.1 (informational)
WRITEWriteFile· step #14
0s
.dockerignore90 bytes written
dockerignore11 lines · 90 chars
node_modules
.git
dist
coverage
npm-debug.log
.yarn-debug.log
.yarn-error.log
.env
*.log

WRITEWriteFile· step #15
0s
Dockerfile1711 bytes written
text69 lines · 1711 chars
FROM node:slim

# Install build tools and Python (Python 3 alias) for npm install prepublish hooks
RUN apt-get update \
  && apt-get install -y --no-install-recommends make ca-certificates python3 python-is-python3 \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy manifest files first so npm install can run prepublish (which may call make)
COPY Makefile ./
COPY package.json ./
COPY package-lock.json* ./

# Copy the rest of the repository
COPY . ./

# Install dependencies (including devDependencies for build)
RUN npm install

# Build from source (dist will be generated in dist/)
RUN npm run build

# Create a small static HTTP server to serve dist/
RUN cat > /app/server.js << 'JS'
const http = require('http');
const path = require('path');
const fs = require('fs');

const distDir = path.resolve(__dirname, 'dist');
const mime = {
  '.js': 'application/javascript',
  '.css': 'text/css',
  '.html': 'text/html',
  '.json': 'application/json',
  '.png': 'image/png',
  '.jpg': 'image/jpeg',
  '.jpeg': 'image/jpeg',
  '.gif': 'image/gif',
  '.svg': 'image/svg+xml'
};

function serve(req, res) {
  let url = req.url.split('?')[0];
  if (url === '/') url = '/index.html';
  const filePath = path.join(distDir, url);
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end('Not found');
      return;
    }
    const ext = path.extname(filePath);
    res.setHeader('Content-Type', mime[ext] || 'application/octet-stream');
    res.end(data);
  });
}

const server = http.createServer(serve);
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log('Serving dist/ on port', PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #16
1m 18s
VerifyBuildbuild_failed
Build error
- Failing step (command/step):
  - [ 8/10] RUN npm install
- Exact error message and exit code:
  - Parse error at dist/share.js:3966,13
  - getLength() { return getSnapshot().length },
  - SyntaxError: Unexpected token: punc (()
  - npm error code 2
  - A complete log of this run can be found in: /root/.npm/_logs/2026-03-17T23_15_51_453Z-debug-0.log
  - ERROR: failed to build: failed to solve: process "/bin/sh -c npm install" did not complete successfully: exit code: 2
- Failing/problematic file:
  - dist/share.js (minification step using uglify-js produced a SyntaxError)
- Missing packages or files mentioned:
  - None explicitly mentioned as missing; the issue is a parse error in the generated dist/share.js during npm install.
- Version mismatch / environment notes:
  - The error occurs during minification with uglify-js, suggesting the code uses ES6 syntax (e.g., getLength() { return getSnapshot().length },) that older uglify-js may not support, indicating a tooling version mismatch.
  - npm notice: New patch version of npm available! 11.11.0 -> 11.11.1 (informational).
WRITEWriteFile· step #17
0s
Dockerfile1754 bytes written
text70 lines · 1754 chars
FROM node:slim

WORKDIR /app

# Copy package manifests and install dependencies without running prepublish/minify scripts
COPY package.json ./
COPY package-lock.json* ./
RUN npm install --ignore-scripts

# Copy the rest of the repo
COPY . .

# Build the browserified bundle from source
RUN mkdir -p dist \
  && ./node_modules/.bin/browserify -s sharejs lib/client/index.js -o dist/share.js

# Simple static server to serve built assets
RUN cat > /app/server.js << 'JS'
const http = require('http');
const path = require('path');
const fs = require('fs');

const distDir = path.resolve(__dirname, 'dist');
const mime = {
  '.js': 'application/javascript',
  '.css': 'text/css',
  '.html': 'text/html',
  '.json': 'application/json',
  '.png': 'image/png',
  '.jpg': 'image/jpeg',
  '.jpeg': 'image/jpeg',
  '.gif': 'image/gif',
  '.svg': 'image/svg+xml'
};

function serve(req, res) {
  let url = req.url.split('?')[0];
  if (url === '/' || url === '') url = '/index.html';
  // Route /share.js to the built bundle
  let filePath;
  if (url === '/share.js') {
    filePath = path.join(distDir, 'share.js');
  } else {
    // serve from dist/ by stripping leading '/'
    const clean = url.startsWith('/') ? url.slice(1) : url;
    filePath = path.join(distDir, clean);
  }
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end('Not found');
      return;
    }
    const ext = path.extname(filePath);
    res.setHeader('Content-Type', mime[ext] || 'application/octet-stream');
    res.end(data);
  });
}

const server = http.createServer(serve);
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log('Serving dist/ on port', PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #18
1m 13s
VerifyBuildsmoke_failed
Concerns: COPY package-lock.json* may fail if the lock file does not exist in the repository at build time., No HEALTHCHECK defined; container health is not automatically monitored.
Smoke [FAIL]: node /app/server.js & sleep 1; node -e "require('http').get('http://localhost:3000/share.js', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => { process.exit(1); });
  Output: sh: 1: Syntax error: Unterminated quoted string

Smoke [FAIL]: test -f /app/dist/share.js && echo 'share.js exists
  Output: sh: 1: Syntax error: Unterminated quoted string
WRITEWriteFile· step #19
0s
Dockerfile1591 bytes written
text61 lines · 1591 chars
FROM node:slim

WORKDIR /app

# Copy package manifests first to install dependencies (ignore prepublish/minify scripts) and then copy the rest
COPY package.json ./
COPY package-lock.json* ./
RUN npm install --ignore-scripts

# Copy the rest of the repository
COPY . .

# Build the browserified bundle into dist/share.js using the local browserify
RUN mkdir -p dist \
  && ./node_modules/.bin/browserify -s sharejs lib/client/index.js -o dist/share.js

# Simple static server to serve built assets from dist/
RUN cat > /app/server.js << 'JS'
const http = require('http');
const path = require('path');
const fs = require('fs');

const distDir = path.resolve(__dirname, 'dist');
const mime = {
  '.js': 'application/javascript',
  '.css': 'text/css',
  '.html': 'text/html',
  '.json': 'application/json',
  '.png': 'image/png',
  '.jpg': 'image/jpeg',
  '.jpeg': 'image/jpeg',
  '.gif': 'image/gif',
  '.svg': 'image/svg+xml'
};

const server = http.createServer((req, res) => {
  let url = req.url.split('?')[0];
  if (url === '/' || url === '') url = '/index.html';
  const filePath = path.join(distDir, url.startsWith('/') ? url.slice(1) : url);
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end('Not found');
      return;
    }
    const ext = path.extname(filePath);
    res.setHeader('Content-Type', mime[ext] || 'application/octet-stream');
    res.end(data);
  });
});

const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log('Serving dist/ on port', PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #20
53s
VerifyBuildbuild_failed
Build error
Summary (under 1500 chars)

- Exact error message and exit code
  - Error message: "ERROR: failed to prepare extraction snapshot \"extract-838366803-ACPI sha256:a6295e701ff4ef7ca9ac830deb2efd24c28ecafb2cc85c75ee7a590c88a925f6\": parent snapshot sha256:9f72913bd6c002367892f37a157e04ff20cfffcf8a86a5be960361c8c70b8592 does not exist: not found"
  - Exit code: not provided in the log

- Failing command/step
  - Step: 13 (exporting to image)
  - Context: failed during the "exporting to image" phase when preparing the extraction snapshot

- Missing packages or files mentioned
  - None mentioned in the log

- Version mismatch info
  - Base image used: node:slim@sha256:44bcbf493408a824104e74976ae5539f596c46cbe75ed0423a137552a555e2de
  - No explicit version mismatch reported in the log
WRITEWriteFile· step #21
0s
Dockerfile1750 bytes written
text68 lines · 1750 chars
FROM node:slim

# Basic tooling for building JS bundles (no prepublish hooks will be run)
RUN apt-get update \
  && apt-get install -y --no-install-recommends ca-certificates \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install dependencies without running scripts that might require a Makefile
COPY package.json ./
COPY package-lock.json* ./
RUN npm install --ignore-scripts

# Copy the rest of the repository
COPY . .

# Build the browserified bundle (do not minify to avoid older uglify issues)
RUN mkdir -p dist \
  && ./node_modules/.bin/browserify -s sharejs lib/client/index.js -o dist/share.js

# Simple server to serve dist/ content
RUN cat > /app/server.js << 'JS'
const http = require('http');
const path = require('path');
const fs = require('fs');

const distDir = path.resolve(__dirname, 'dist');

const mime = {
  '.js': 'application/javascript',
  '.css': 'text/css',
  '.html': 'text/html',
  '.json': 'application/json',
  '.png': 'image/png',
  '.jpg': 'image/jpeg',
  '.jpeg': 'image/jpeg',
  '.gif': 'image/gif',
  '.svg': 'image/svg+xml'
};

function serve(req, res) {
  let url = req.url.split('?')[0];
  if (url === '/' || url === '') url = '/index.html';
  const filePath = path.join(distDir, url.startsWith('/') ? url.slice(1) : url);
  fs.readFile(filePath, (err, data) => {
    if (err) {
      res.statusCode = 404;
      res.end('Not found');
      return;
    }
    const ext = path.extname(filePath);
    res.setHeader('Content-Type', mime[ext] || 'application/octet-stream');
    res.end(data);
  });
}

const server = http.createServer(serve);
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log('Serving dist/ on port', PORT);
});
JS

EXPOSE 3000

CMD ["node", "/app/server.js"]
VERIFYVerifyBuild· step #22
1m 21s
VerifyBuildaccepted
Smoke [PASS]: test -f /app/dist/share.js
Smoke [PASS]: test -f /app/server.js
Smoke [PASS]: test -f /app/package.json