Run development server using Docker
This commit is contained in:
parent
b0d205d9eb
commit
5c9c4f00e8
|
@ -0,0 +1,11 @@
|
|||
.env
|
||||
.git
|
||||
.gitignore
|
||||
.travis.yml
|
||||
data
|
||||
deploy
|
||||
node_modules
|
||||
private.key
|
||||
scripts
|
||||
tokens
|
||||
unpkg.sketch
|
|
@ -1,5 +1,6 @@
|
|||
.DS_Store
|
||||
.env
|
||||
/data
|
||||
/node_modules
|
||||
/public/_assets
|
||||
/server/stats.json
|
||||
|
@ -8,7 +9,5 @@ npm-debug.log*
|
|||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
dump.rdb
|
||||
|
||||
private.key
|
||||
/tokens
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
FROM node:8
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn --pure-lockfile
|
||||
COPY . .
|
||||
|
||||
ENV PORT 5000
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
EXPOSE 5000
|
|
@ -0,0 +1,7 @@
|
|||
FROM node:8
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn --pure-lockfile
|
||||
COPY . .
|
||||
|
||||
CMD ["node", "server/ingestLogs.js"]
|
|
@ -1,2 +0,0 @@
|
|||
web: NODE_ENV=development node server.js
|
||||
redis: redis-server --port 6379
|
51
README.md
51
README.md
|
@ -3,56 +3,15 @@
|
|||
[build-badge]: https://img.shields.io/travis/unpkg/unpkg/master.svg?style=flat-square
|
||||
[build]: https://travis-ci.org/unpkg/unpkg
|
||||
|
||||
[unpkg](https://unpkg.com) is a fast, global [content delivery network](https://en.wikipedia.org/wiki/Content_delivery_network) for everything on [npm](https://www.npmjs.com/). Use it to quickly and easily load any file from any package using a URL like:
|
||||
[unpkg](https://unpkg.com) is a fast, global [content delivery network](https://en.wikipedia.org/wiki/Content_delivery_network) for everything on [npm](https://www.npmjs.com/).
|
||||
|
||||
<div style="text-align:center">
|
||||
<code>unpkg.com/:package@:version/:file</code>
|
||||
</div>
|
||||
### Documentation
|
||||
|
||||
### Examples
|
||||
Please visit [the unpkg website](https://unpkg.com) to learn more about how to use it.
|
||||
|
||||
Using a fixed version:
|
||||
### Development
|
||||
|
||||
* [unpkg.com/react@16.0.0/umd/react.production.min.js](//unpkg.com/react@16.0.0/umd/react.production.min.js)
|
||||
* [unpkg.com/react-dom@16.0.0/umd/react-dom.production.min.js](//unpkg.com/react-dom@16.0.0/umd/react-dom.production.min.js)
|
||||
|
||||
You may also use a [semver range](https://docs.npmjs.com/misc/semver) or a [tag](https://docs.npmjs.com/cli/dist-tag) instead of a fixed version number, or omit the version/tag entirely to use the `latest` tag.
|
||||
|
||||
* [unpkg.com/react@^16/umd/react.production.min.js](//unpkg.com/react@^16/umd/react.production.min.js)
|
||||
* [unpkg.com/react/umd/react.production.min.js](//unpkg.com/react/umd/react.production.min.js)
|
||||
|
||||
If you omit the file path (i.e. use a "bare" URL), unpkg will serve the file specified by the `unpkg` field in `package.json`, or fall back to `main`.
|
||||
|
||||
* [unpkg.com/d3](//unpkg.com/d3)
|
||||
* [unpkg.com/jquery](//unpkg.com/jquery)
|
||||
* [unpkg.com/three](//unpkg.com/three)
|
||||
|
||||
Append a `/` at the end of a URL to view a listing of all the files in a package.
|
||||
|
||||
* [unpkg.com/react/](//unpkg.com/react/)
|
||||
* [unpkg.com/lodash/](//unpkg.com/lodash/)
|
||||
|
||||
### Query Parameters
|
||||
|
||||
<dl>
|
||||
<dt>?meta</dt>
|
||||
<dd>Return metadata about any file in a package as JSON (e.g. `/any/file?meta`)</dd>
|
||||
|
||||
<dt>?module</dt>
|
||||
<dd>Expands all ["bare" `import` specifiers](https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier) in JavaScript modules to unpkg URLs. This feature is *very experimental*</dd>
|
||||
</dl>
|
||||
|
||||
### Cache Behavior
|
||||
|
||||
The CDN caches files based on their permanent URL, which includes the npm package version. This works because npm does not allow package authors to overwrite a package that has already been published with a different one at the same version number.
|
||||
|
||||
URLs that do not specify a package version number redirect to one that does. This is the `latest` version when no version is specified, or the `maxSatisfying` version when a [semver version](https://github.com/npm/node-semver) is given. Redirects are cached for 5 minutes.
|
||||
|
||||
Browsers are instructed (via the `Cache-Control` header) to cache assets for 4 hours.
|
||||
|
||||
### Feedback
|
||||
|
||||
If you think this is useful, we'd love to hear from you. Please reach out to [@unpkg](https://twitter.com/unpkg) with any questions or concerns.
|
||||
To boot the development server, first you'll need to [install Docker](https://docs.docker.com/install/). Then, you can get everything running with `docker-compose up`.
|
||||
|
||||
### Sponsors
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
version: "3"
|
||||
|
||||
networks:
|
||||
localnet: {}
|
||||
|
||||
volumes:
|
||||
pkgvol: {}
|
||||
|
||||
services:
|
||||
|
||||
cache:
|
||||
image: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
networks:
|
||||
- localnet
|
||||
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.server
|
||||
ports:
|
||||
- "8080:5000"
|
||||
volumes:
|
||||
- pkgvol:/packages
|
||||
networks:
|
||||
- localnet
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- cache
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.worker
|
||||
networks:
|
||||
- localnet
|
||||
env_file: .env
|
||||
depends_on:
|
||||
- cache
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "heroku local -f Procfile.dev",
|
||||
"start": "echo 'Use `docker-compose up` to start the server",
|
||||
"build": "NODE_ENV=production webpack -p --json > server/stats.json",
|
||||
"lint": "eslint client && eslint server",
|
||||
"test": "jest"
|
||||
|
@ -68,9 +68,6 @@
|
|||
"node": "8"
|
||||
},
|
||||
"jest": {
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"__tests__/utils"
|
||||
]
|
||||
"testPathIgnorePatterns": ["/node_modules/", "__tests__/utils"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue