Simple and easy to use http server for angular 2+ apps.
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
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
See and try example.
cd example
npm i
npm run build
docker-compose up --build
It will create three different endpoints:
Content type
Image
Digest
Size
1.9 MB
Last updated
over 5 years ago
docker pull fullpipe/ngserve