Skip to content

Commit

Permalink
added angular dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredfrancis committed Apr 3, 2018
1 parent bef666f commit 86471dc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ services:
depends_on:
- mongodb

frontend:
build: frontend/
ports:
- "8081:80"
depends_on:
- web

mongodb:
image: mongo
hostname: mongodb
Expand Down
33 changes: 33 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
### STAGE 1: Build ###

# We label our stage as 'builder'
FROM node:8-alpine as builder

COPY package.json package-lock.json ./

RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app

WORKDIR /ng-app

COPY . .

## Build the angular app in production mode and store the artifacts in dist folder
RUN $(npm bin)/ng build --prod --build-optimizer

### STAGE 2: Setup ###

FROM nginx:1.13.3-alpine

## Copy our default nginx config
COPY nginx/default.conf /etc/nginx/conf.d/

## Remove default nginx website
RUN rm -rf /usr/share/nginx/html/*

## From 'builder' stage copy over the artifacts in dist folder to default nginx public folder
COPY --from=builder /ng-app/dist /usr/share/nginx/html

CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion frontend/src/app/agent/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SettingsComponent implements OnInit {
}
handleFileInput(files: FileList) {
this.fileToUpload = files.item(0);
}
}

uploadFileToActivity() {
this.intentService.importStories(this.fileToUpload).then ((result)=>{
Expand Down

0 comments on commit 86471dc

Please sign in to comment.