diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1c3cdbc27 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx + +COPY nginx.conf /etc/nginx/nginx.conf + +WORKDIR /usr/share/nginx/html +COPY dist/ . + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..3ecf2b560 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.1' + +services: + app: + image: 'alfresco/content-app' + build: '.' + ports: + - 3000:80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 000000000..e898ca067 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,27 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + location / { + # If you want to enable html5Mode(true) in your angularjs app for pretty URL + # then all request for your angularJS app will be through index.html + try_files $uri /index.html; + } + } +} diff --git a/package.json b/package.json index 503d04dac..125142c12 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "scripts": { "ng": "ng", "start": "ng serve --open", - "build": "ng build", + "build": "ng build --prod", + "build:dev": "ng build && node postbuild-dev.js", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", diff --git a/postbuild-dev.js b/postbuild-dev.js new file mode 100644 index 000000000..02544050d --- /dev/null +++ b/postbuild-dev.js @@ -0,0 +1,26 @@ +/*! + * @license + * Copyright 2017 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var fs = require('fs'); +var config = require('./dist/app.config.json'); + +config.ecmHost = 'http://localhost:8080'; + +fs.writeFileSync( + './dist/app.config.json', + JSON.stringify(config, null, 4) +); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 36072abef..9be78dbd3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -46,7 +46,6 @@ import { SidenavComponent } from './components/sidenav/sidenav.component'; imports: [ BrowserModule, RouterModule.forRoot(APP_ROUTES, { - useHash: true, enableTracing: false // enable for debug only }), AdfModule,