https://github.com/fullpipe/ngserve
Simple and easy to use http server for angular 2+ apps.
https://github.com/fullpipe/ngserve
angular angular10 angular2 docker http
Last synced: 8 months ago
JSON representation
Simple and easy to use http server for angular 2+ apps.
- Host: GitHub
- URL: https://github.com/fullpipe/ngserve
- Owner: fullpipe
- License: mit
- Created: 2020-11-25T19:21:52.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-10T14:39:08.000Z (about 4 years ago)
- Last Synced: 2025-03-13T22:12:18.798Z (about 1 year ago)
- Topics: angular, angular10, angular2, docker, http
- Language: Go
- Homepage:
- Size: 428 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngserve
[](https://github.com/fullpipe/ngserve)
[](https://cloud.docker.com/repository/docker/fullpipe/ngserve)
Simple and easy to use http server for angular 2+ apps.
## Usage
Add `Dockerfile` to the root of your angular app project.
```Dockerfile
# Build
FROM node:lts-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build --prod
# App image
FROM fullpipe/ngserve:latest
COPY --from=build /app/dist/example/ /app/
```
First stage will build your app. Second will copy `dist` to `ngserve` web root
directory.
Or if you build on your own
```Dockerfile
FROM fullpipe/ngserve:latest
# Do not forget to add end-slashes to copy dir content
COPY dist/example/ /app/
```
Now you can build and run you app
```bash
docker build -t example .
docker run -p 8080:8080 example
```
## Env vars
- APP_ROOT, root path for your app. Default `/`. If you want for example
`/user/`. Set `APP_ROOT=/user/` and do not forget to change `deployUrl` in
`angular.json` to `/user`
- NO_CACHE, disables in memory file cache. Default `false`
- PORT, default 8080. Do not forget to `EXPOSE 123`, if changed
## Example
See and try [example](https://github.com/fullpipe/ngserve/tree/main/example).
```bash
cd example
npm i
npm run build
docker-compose up --build
```
It will create three different endpoints:
- http://localhost:8080/
- http://localhost:8081/
- http://localhost:8082/
## TODO:
- benchmarks against nginx
- logs?