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:
|
||||
build:
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
- image: circleci/node:8.9.4
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
|
@ -15,7 +15,3 @@ jobs:
|
|||
- run:
|
||||
name: Run Tests
|
||||
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
|
||||
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
|
||||
RUN mkdir -p /public
|
||||
|
||||
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
|
||||
|
||||
ENV NODE_ENV production
|
||||
|
||||
RUN npm run build
|
||||
|
||||
RUN npm prune --production
|
||||
|
||||
RUN npm install -g .
|
||||
|
||||
WORKDIR /
|
||||
|
||||
CMD tstatic /var/www
|
||||
CMD npm start -- /public
|
||||
|
||||
EXPOSE 5000
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
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)
|
||||
|
@ -24,6 +25,7 @@ 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.
|
||||
|
@ -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>`.
|
||||
|
||||
### 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:
|
||||
|
||||
|
@ -66,7 +68,9 @@ services:
|
|||
context: .
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- ./site/:/var/www
|
||||
- ./site/:/public
|
||||
ports:
|
||||
- "5000:5000"
|
||||
```
|
||||
|
||||
__Note__: `tstatic` isn't installed into the path, so run it using `npm start --`
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "node ./dist/index.js",
|
||||
"prepublishOnly": "npm run build",
|
||||
"prepublish": "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"
|
||||
"node": "8.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Reference in a new issue