Sign inSign up

fullpipe/ngserve

By fullpipe

•Updated over 5 years ago

Image
0

1.0K

fullpipe/ngserve repository overview

⁠ngserve

Tests Status Docker Image

Simple and easy to use http server for angular 2+ apps.

⁠Usage

Add Dockerfile to the root of your angular app project.

# 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

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

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⁠.

cd example
npm i
npm run build
docker-compose up --build

It will create three different endpoints:

⁠TODO:

  • benchmarks against nginx
  • logs?

Tag summary

Content type

Image

Digest

Size

1.9 MB

Last updated

over 5 years ago

docker pull fullpipe/ngserve