Compare commits

...

9 commits

4 changed files with 27 additions and 18 deletions

View file

@ -3,7 +3,7 @@ version: 2.0
jobs:
build:
docker:
- image: circleci/node:8.9.4
- image: circleci/node:8
steps:
- checkout
- run:
@ -15,3 +15,7 @@ jobs:
- run:
name: Run Tests
command: npm test
- setup_remote_docker
- run:
name: Build docker container
command: docker build .

View file

@ -1,18 +1,27 @@
FROM node:8.10.0-alpine
FROM node:8-alpine
RUN mkdir -p /public
COPY ./src /opt/tstatic/src
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
COPY ./src /app/src
COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json
COPY ./tsconfig.json /app/tsconfig.json
WORKDIR /opt/tstatic
WORKDIR /app
RUN apk add --no-cache git
RUN npm install
ENV NODE_ENV production
RUN npm run build
CMD npm start -- /public
RUN npm prune --production
RUN npm install -g .
WORKDIR /
CMD tstatic /var/www
EXPOSE 5000

View file

@ -7,7 +7,6 @@
The only static-file server you'll ever need!
### Features:
- Logging - [`winston`](https://www.npmjs.com/package/winston)
- Basic-Auth - [`basic-auth`](https://www.npmjs.com/package/basic-auth)
- Custom 404 page
- Optimum Compression - [`compression`](https://www.npmjs.com/package/compression)
@ -25,7 +24,6 @@ The only static-file server you'll ever need!
-b <auth> --basic-auth=<auth> Enable basic-auth.
-i <ips> --ips=<ips> Allowed IP addresses.
-l --list-dir List Directory.
--opbeat Enable Opbeat.
-o --open Open in browser after start.
```
`dir` is where your static files are.
@ -39,7 +37,7 @@ The only static-file server you'll ever need!
The port for the server to listen on. Currently supports plain HTTP only
##### `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`
@ -55,7 +53,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>`.
### Docker
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.
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.
Below is an example `docker-compose.yml` file you can use with it:
@ -68,9 +66,7 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- ./site/:/public
- ./site/:/var/www
ports:
- "5000:5000"
```
__Note__: `tstatic` isn't installed into the path, so run it using `npm start --`

View file

@ -8,14 +8,14 @@
},
"scripts": {
"start": "node ./dist/index.js",
"prepublish": "npm run build",
"prepublishOnly": "npm run build",
"build": "tsc",
"test": "npm run lint && npm run mocha",
"mocha": "mocha --require scripts/test-helper.js --recursive --bail tests/**/*.test.ts tests/*.test.ts",
"lint": "tslint src/**/*.ts --project tsconfig.json"
},
"engines": {
"node": "8.10.0"
"node": "8"
},
"repository": {
"type": "git",