Skip to content

Commit 0f29100

Browse files
committed
update dockerfile
1 parent c135f36 commit 0f29100

File tree

3 files changed

+12558
-66
lines changed

3 files changed

+12558
-66
lines changed

Dockerfile

+2-38
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,3 @@
1-
# Usage:
2-
#
3-
# Build image:
4-
# docker build -t text-compare .
5-
#
6-
# Run image (on localhost:8080):
7-
# docker run --name text-compare -p 8080:80 text-compare
8-
#
9-
# Run image as virtual host (read more: https://github.com/jwilder/nginx-proxy):
10-
# docker run -e VIRTUAL_HOST=text-compare.your-domain.com --name text-compare text-compare
1+
FROM nginx:latest
112

12-
# Stage 1, based on Node.js, to build and compile Angular
13-
14-
FROM node:9.4.0-alpine as builder
15-
16-
COPY package.json ./
17-
18-
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
19-
RUN npm i && mkdir /ng-app && mv ./node_modules ./ng-app
20-
21-
WORKDIR /ng-app
22-
23-
COPY . .
24-
25-
RUN npm run build:aot:prod
26-
27-
# Stage 2, based on Nginx, to have only the compiled app, ready for production with Nginx
28-
29-
FROM nginx:1.13.12-alpine
30-
31-
COPY ./config/nginx-custom.conf /etc/nginx/conf.d/default.conf
32-
33-
## Remove default nginx website
34-
RUN rm -rf /usr/share/nginx/html/*
35-
36-
## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
37-
COPY --from=builder /ng-app/dist /usr/share/nginx/html
38-
39-
CMD ["nginx", "-g", "daemon off;"]
3+
COPY ./dist/ /usr/share/nginx/html/

Dockerfile2

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Usage:
2+
#
3+
# Build image:
4+
# docker build -t text-compare .
5+
#
6+
# Run image (on localhost:8080):
7+
# docker run --name text-compare -p 8080:80 text-compare
8+
#
9+
# Run image as virtual host (read more: https://github.com/jwilder/nginx-proxy):
10+
# docker run -e VIRTUAL_HOST=text-compare.your-domain.com --name text-compare text-compare
11+
12+
# Stage 1, based on Node.js, to build and compile Angular
13+
14+
FROM node:9.4.0-alpine as builder
15+
16+
COPY package.json ./
17+
18+
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
19+
RUN npm i && mkdir /ng-app && mv ./node_modules ./ng-app
20+
21+
WORKDIR /ng-app
22+
23+
COPY . .
24+
25+
RUN npm run build:aot:prod
26+
27+
# Stage 2, based on Nginx, to have only the compiled app, ready for production with Nginx
28+
29+
FROM nginx:1.13.12-alpine
30+
31+
COPY ./config/nginx-custom.conf /etc/nginx/conf.d/default.conf
32+
33+
## Remove default nginx website
34+
RUN rm -rf /usr/share/nginx/html/*
35+
36+
## From ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
37+
COPY --from=builder /ng-app/dist /usr/share/nginx/html
38+
39+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)