Compare commits
No commits in common. "master" and "v1.2.0" have entirely different histories.
4 changed files with 18 additions and 27 deletions
|
@ -3,7 +3,7 @@ version: 2.0
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:8
|
- image: circleci/node:8.9.4
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
|
@ -15,7 +15,3 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run Tests
|
name: Run Tests
|
||||||
command: npm test
|
command: npm test
|
||||||
- setup_remote_docker
|
|
||||||
- run:
|
|
||||||
name: Build docker container
|
|
||||||
command: docker build .
|
|
||||||
|
|
25
Dockerfile
25
Dockerfile
|
@ -1,27 +1,18 @@
|
||||||
FROM node:8-alpine
|
FROM node:8.10.0-alpine
|
||||||
|
|
||||||
COPY ./src /opt/tstatic/src
|
RUN mkdir -p /public
|
||||||
COPY ./package.json opt/tstatic/package.json
|
|
||||||
COPY ./package-lock.json opt/tstatic/package-lock.json
|
|
||||||
COPY ./tsconfig.json opt/tstatic/tsconfig.json
|
|
||||||
COPY ./site /var/www
|
|
||||||
|
|
||||||
WORKDIR /opt/tstatic
|
COPY ./src /app/src
|
||||||
|
COPY ./package.json /app/package.json
|
||||||
|
COPY ./package-lock.json /app/package-lock.json
|
||||||
|
COPY ./tsconfig.json /app/tsconfig.json
|
||||||
|
|
||||||
RUN apk add --no-cache git
|
WORKDIR /app
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
ENV NODE_ENV production
|
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
RUN npm prune --production
|
CMD npm start -- /public
|
||||||
|
|
||||||
RUN npm install -g .
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
|
|
||||||
CMD tstatic /var/www
|
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
10
README.md
10
README.md
|
@ -7,6 +7,7 @@
|
||||||
The only static-file server you'll ever need!
|
The only static-file server you'll ever need!
|
||||||
|
|
||||||
### Features:
|
### Features:
|
||||||
|
- Logging - [`winston`](https://www.npmjs.com/package/winston)
|
||||||
- Basic-Auth - [`basic-auth`](https://www.npmjs.com/package/basic-auth)
|
- Basic-Auth - [`basic-auth`](https://www.npmjs.com/package/basic-auth)
|
||||||
- Custom 404 page
|
- Custom 404 page
|
||||||
- Optimum Compression - [`compression`](https://www.npmjs.com/package/compression)
|
- Optimum Compression - [`compression`](https://www.npmjs.com/package/compression)
|
||||||
|
@ -24,6 +25,7 @@ The only static-file server you'll ever need!
|
||||||
-b <auth> --basic-auth=<auth> Enable basic-auth.
|
-b <auth> --basic-auth=<auth> Enable basic-auth.
|
||||||
-i <ips> --ips=<ips> Allowed IP addresses.
|
-i <ips> --ips=<ips> Allowed IP addresses.
|
||||||
-l --list-dir List Directory.
|
-l --list-dir List Directory.
|
||||||
|
--opbeat Enable Opbeat.
|
||||||
-o --open Open in browser after start.
|
-o --open Open in browser after start.
|
||||||
```
|
```
|
||||||
`dir` is where your static files are.
|
`dir` is where your static files are.
|
||||||
|
@ -37,7 +39,7 @@ The only static-file server you'll ever need!
|
||||||
The port for the server to listen on. Currently supports plain HTTP only
|
The port for the server to listen on. Currently supports plain HTTP only
|
||||||
|
|
||||||
##### `basic-auth`
|
##### `basic-auth`
|
||||||
Enable basic-auth for all paths. Currently only supports single credentals.
|
Enable basic-auth for all paths. Currently only supports single credentals.
|
||||||
|
|
||||||
Format:`-b username:password`
|
Format:`-b username:password`
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ Enables directory listing. Allow browseing
|
||||||
Open the server in the browser one started. It will open in your default browser, and use url `http://0.0.0.0:<port>`.
|
Open the server in the browser one started. It will open in your default browser, and use url `http://0.0.0.0:<port>`.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
Included in this repo is a `Dockerfile` to use. The default setup requires being run from the project directory, and will serve `/var/www` in the container on port `5000`. By default, this directory is contains a simple index file, however can be overriden.
|
Included in this repo is a `Dockerfile` to use. The default setup requires being run from the project directory, and will serve `/public` in the container on port `5000`. By default, this directory is empty, however can be overriden.
|
||||||
|
|
||||||
Below is an example `docker-compose.yml` file you can use with it:
|
Below is an example `docker-compose.yml` file you can use with it:
|
||||||
|
|
||||||
|
@ -66,7 +68,9 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
volumes:
|
volumes:
|
||||||
- ./site/:/var/www
|
- ./site/:/public
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
__Note__: `tstatic` isn't installed into the path, so run it using `npm start --`
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./dist/index.js",
|
"start": "node ./dist/index.js",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublish": "npm run build",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "npm run lint && npm run mocha",
|
"test": "npm run lint && npm run mocha",
|
||||||
"mocha": "mocha --require scripts/test-helper.js --recursive --bail tests/**/*.test.ts tests/*.test.ts",
|
"mocha": "mocha --require scripts/test-helper.js --recursive --bail tests/**/*.test.ts tests/*.test.ts",
|
||||||
"lint": "tslint src/**/*.ts --project tsconfig.json"
|
"lint": "tslint src/**/*.ts --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "8"
|
"node": "8.10.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
Reference in a new issue