File tree 4 files changed +27
-22
lines changed
4 files changed +27
-22
lines changed Original file line number Diff line number Diff line change 1
- # This image is based on the fat node 11 image.
2
- # We require fat images as neither alpine, or slim, include git binaries.
3
- FROM node:11
4
-
5
- # Port 8100 for ionic dev server.
6
- EXPOSE 8100
7
-
8
- # Port 35729 is the live-reload server.
9
- EXPOSE 35729
10
-
11
- # Port 53703 is the Chrome dev logger port.
12
- EXPOSE 53703
1
+ # # BUILD STAGE
2
+ FROM node:14 as build-stage
13
3
14
4
WORKDIR /app
15
5
16
- # Install npm libraries.
6
+ # Prepare node dependencies
7
+ RUN apt-get update && apt-get install libsecret-1-0 -y
17
8
COPY package*.json ./
18
9
RUN npm ci
19
- # Delete caches.
20
- RUN rm -rf /root/.npm
21
10
11
+ # Build source
12
+ ARG build_command="npm run build:prod"
22
13
COPY . /app
14
+ RUN ${build_command}
23
15
24
- # Run gulp before starting.
25
- RUN npx gulp
26
-
27
- # Provide a Healthcheck command for easier use in CI.
28
- HEALTHCHECK --interval=10s --timeout=5s --start-period=60s CMD curl -f http://localhost:8100 || exit 1
16
+ # # SERVE STAGE
17
+ FROM nginx:alpine as serve-stage
29
18
30
- CMD ["npm" , "run" , "ionic:serve" ]
19
+ # Copy assets
20
+ COPY --from=build-stage /app/www /usr/share/nginx/html
Original file line number Diff line number Diff line change 69
69
"builder" : " @angular-devkit/build-angular:dev-server" ,
70
70
"options" : {
71
71
"browserTarget" : " app:build" ,
72
+ "disableHostCheck" : true ,
72
73
"port" : 8100
73
74
},
74
75
"configurations" : {
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Override DockerHub build hook in order to create images of different flavors (production & testing).
3
+ # See: https://docs.docker.com/docker-hub/builds/advanced/
4
+
5
+ if [[ " $IMAGE_NAME " == * -test ]]
6
+ then
7
+ docker build --build-arg build_command=" npm run build:test" -f $DOCKERFILE_PATH -t $IMAGE_NAME .
8
+ elif [[ " $IMAGE_NAME " == * -dev ]]
9
+ then
10
+ docker build --build-arg build_command=" npm run build" -f $DOCKERFILE_PATH -t $IMAGE_NAME .
11
+ else
12
+ docker build -f $DOCKERFILE_PATH -t $IMAGE_NAME .
13
+ fi
Original file line number Diff line number Diff line change 21
21
"ng" : " ng" ,
22
22
"start" : " ionic serve" ,
23
23
"build" : " ionic build" ,
24
- "build:prod" : " ionic build --prod" ,
24
+ "build:prod" : " NODE_ENV=production ionic build --prod" ,
25
+ "build:test" : " NODE_ENV=testing ionic build" ,
25
26
"test" : " NODE_ENV=testing gulp && jest --verbose" ,
26
27
"test:ci" : " NODE_ENV=testing gulp && jest -ci --runInBand --verbose" ,
27
28
"test:watch" : " NODE_ENV=testing gulp watch & jest --watch" ,
You can’t perform that action at this time.
0 commit comments