production build setup

This commit is contained in:
Denys Vuika 2017-11-06 14:11:04 +00:00
parent e0efdeb12b
commit d10255b843
6 changed files with 70 additions and 2 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM nginx
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html
COPY dist/ .

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: '3.1'
services:
app:
image: 'alfresco/content-app'
build: '.'
ports:
- 3000:80

27
nginx.conf Normal file
View File

@ -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;
}
}
}

View File

@ -5,7 +5,8 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve --open", "start": "ng serve --open",
"build": "ng build", "build": "ng build --prod",
"build:dev": "ng build && node postbuild-dev.js",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e",

26
postbuild-dev.js Normal file
View File

@ -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)
);

View File

@ -46,7 +46,6 @@ import { SidenavComponent } from './components/sidenav/sidenav.component';
imports: [ imports: [
BrowserModule, BrowserModule,
RouterModule.forRoot(APP_ROUTES, { RouterModule.forRoot(APP_ROUTES, {
useHash: true,
enableTracing: false // enable for debug only enableTracing: false // enable for debug only
}), }),
AdfModule, AdfModule,