Skip to content

Commit

Permalink
chore: prepared application for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
torbrenner committed Jun 15, 2023
1 parent bf3e74c commit d89d5f1
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 21 deletions.
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
ARG PRODUCTION=false
FROM node:lts as build
ARG PRODUCTION=false
WORKDIR /usr/src/app
RUN sh -c '[ -z "$http_proxy" ] || ( npm config set proxy $http_proxy; npm config set https-proxy $http_proxy )'
COPY package.json package-lock.json ./
RUN npm install
COPY ./angular.json ./tsconfig.json ./tsconfig.app.json ./tsconfig.spec.json ./
COPY ./angular.json ./tsconfig.json ./tsconfig.app.json ./tsconfig.spec.json ./messages*.xlf ./
COPY ./src ./src
RUN sh -c 'if [ "${PRODUCTION}" = true ]; then npm run build:prod; else npm run build; fi'
RUN if [ "${PRODUCTION}" = true ];then \
npm run build:prod; \
else \
npm run build; \
fi;

FROM nginx:stable-alpine
ENV NGINX_PORT=80 NGINX_DEPLOYMENT_CONTEXT=/
COPY nginx.conf /etc/nginx/templates/nginx.conf.template
COPY nginx.conf /etc/nginx/nginx.conf
# fixed unshown font icons with mime.types file and ngnix.conf > location ~* .(js|css|ttf|ttc|otf|eot|woff|woff2)$ {...
COPY mime.types /etc/nginx/mime.types
COPY --from=build /usr/src/app/dist/* /usr/share/nginx/html/
16 changes: 13 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"root": "",
"sourceRoot": "src",
"prefix": "app",
"i18n": {
"sourceLocale": "en-US",
"locales": {
"de": {
"translation": "./messages.de.xlf"
}
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
Expand Down Expand Up @@ -38,7 +46,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
Expand All @@ -52,15 +60,17 @@
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
"outputHashing": "all",
"localize": ["de"]
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
"namedChunks": true,
"localize": ["de"]
}
},
"defaultConfiguration": "production"
Expand Down
128 changes: 128 additions & 0 deletions messages.de.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en-US" datatype="plaintext" original="ng2.template">
<body>
<trans-unit id="date-condition-builder.from" datatype="html">
<source>from:</source>
<target>von:</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/criteria-catalogue/components/date-condition-builder/date-condition-builder.component.html</context>
<context context-type="linenumber">2</context>
</context-group>
</trans-unit>
<trans-unit id="date-condition-builder.to" datatype="html">
<source>to:</source>
<target>bis:</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/criteria-catalogue/components/date-condition-builder/date-condition-builder.component.html</context>
<context context-type="linenumber">12</context>
</context-group>
</trans-unit>
<trans-unit id="number-condition-builder.equals" datatype="html">
<source>equals:</source>
<target>gleich:</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/criteria-catalogue/components/number-condition-builder/number-condition-builder.component.html</context>
<context context-type="linenumber">2</context>
</context-group>
</trans-unit>
<trans-unit id="number-condition-builder.from" datatype="html">
<source>from:</source>
<target>von:</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/criteria-catalogue/components/number-condition-builder/number-condition-builder.component.html</context>
<context context-type="linenumber">10</context>
</context-group>
</trans-unit>
<trans-unit id="number-condition-builder.to" datatype="html">
<source>to:</source>
<target>bis:</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/criteria-catalogue/components/number-condition-builder/number-condition-builder.component.html</context>
<context context-type="linenumber">19</context>
</context-group>
</trans-unit>
<trans-unit id="2455725920612353578" datatype="html">
<source>Ask <x id="INTERPOLATION" equiv-text="{{selectedNegotiationPartners.length}} sites to negotiate"/> sites to negotiate</source>
<target>Daten bei <x id="INTERPOLATION" equiv-text="{{selectedNegotiationPartners.length}} sites to negotiate"/> Standorten anfragen</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/negotiate-button/negotiate-button.component.html</context>
<context context-type="linenumber">10,11</context>
</context-group>
<note priority="1" from="description">indication for the user that clicking this button will start negotiation with multiple sites</note>
</trans-unit>
<trans-unit id="8969037609074820934" datatype="html">
<source>Search has been modified!</source>
<target>Diagramme repräsentieren nicht mehr die aktuelle Suche!</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/negotiate-button/negotiate-button.component.html</context>
<context context-type="linenumber">20</context>
</context-group>
<note priority="1" from="description">warn the user that search parameters are modified</note>
</trans-unit>
<trans-unit id="4203652128950847512" datatype="html">
<source>Sites</source>
<target>Standorte</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/result-table/result-table.component.html</context>
<context context-type="linenumber">8</context>
</context-group>
<note priority="1" from="description">column header for the name of a site</note>
</trans-unit>
<trans-unit id="2904579647410573959" datatype="html">
<source>Patients</source>
<target>Patienten</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/result-table/result-table.component.html</context>
<context context-type="linenumber">9</context>
</context-group>
<note priority="1" from="description">column header for the number of patients</note>
</trans-unit>
<trans-unit id="1159573015632588468" datatype="html">
<source>Specimen</source>
<target>Bioproben</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/result-table/result-table.component.html</context>
<context context-type="linenumber">10</context>
</context-group>
<note priority="1" from="description">column header for the number of specimen</note>
</trans-unit>
<trans-unit id="135450262813974755" datatype="html">
<source>[type your search criteria here]</source>
<target>[Hier Suchkriterien eingeben]</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/search-bar/search-bar.component.html</context>
<context context-type="linenumber">5</context>
</context-group>
<note priority="1" from="description">placeholder for users search request</note>
</trans-unit>
<trans-unit id="6233358794697333609" datatype="html">
<source> Click here to view your detailed query. </source>
<target>Hier klicken um die detaillierte Suchanfrage anzuzeigen</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/search-bar/search-bar.component.html</context>
<context context-type="linenumber">39,37</context>
</context-group>
<note priority="1" from="description">hint the user that clicking this button will show the detailed query</note>
</trans-unit>
<trans-unit id="4580988005648117665" datatype="html">
<source>Search</source>
<target>Suchen</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/search-bar/search-bar.component.html</context>
<context context-type="linenumber">51</context>
</context-group>
<note priority="1" from="description">text for the search button</note>
</trans-unit>
<trans-unit id="8700121026680200191" datatype="html">
<source>Clear</source>
<target>Löschen</target>
<context-group purpose="location">
<context context-type="sourcefile">projects/lens-core/src/lib/components/search-bar/search-bar.component.html</context>
<context context-type="linenumber">58</context>
</context-group>
<note priority="1" from="description">text for the clear button</note>
</trans-unit>
</body>
</file>
</xliff>
100 changes: 100 additions & 0 deletions mime.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;

text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;

image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;

font/woff woff;

application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;

application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;

audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;

video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;

application/x-font-ttf ttc;
application/x-font-otf otf;
application/font-woff2 woff2;
font/ttf ttf;
}
73 changes: 64 additions & 9 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,68 @@
server {
worker_processes 1;

listen ${NGINX_PORT};
listen [::]:${NGINX_PORT};
server_name ${NGINX_SERVER_NAME};
events {
worker_connections 1024;
}

root /usr/share/nginx/html;
index index.html;
location ${NGINX_DEPLOYMENT_CONTEXT} {
try_files $uri $uri/ /index.html;
}
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/css
text/plain
text/javascript
application/javascript
application/json
application/x-javascript
application/xml
application/xml+rss
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject
image/svg+xml
image/x-icon
application/rss+xml
application/atom_xml;

location /de/ {
alias /usr/share/nginx/html/de/;
try_files $uri$args $uri$args/ /de/index.html;
}
location /en/ {
alias /usr/share/nginx/html/en/;
try_files $uri$args $uri$args/ /en/index.html;
}

set $first_language $http_accept_language;
if ($http_accept_language ~* '^(.+?),') {
set $first_language $1;
}

set $language_suffix 'de';
if ($first_language ~* 'de') {
set $language_suffix 'de';
}
if ($first_language ~* 'en') {
set $language_suffix 'en';
}

location / {
rewrite ^/$ http://localhost/$language_suffix/index.html permanent;
}

location ~* .(js|css|ttf|ttc|otf|eot|woff|woff2)$ {
add_header access-control-allow-origin "*";
expires max;
}
}
}
4 changes: 2 additions & 2 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header class="row line">
<p-image [src]="'/assets/dktk.svg'" alt="DKTK"></p-image>
<p-image [src]="'assets/dktk.svg'" alt="DKTK"></p-image>
<span class="ccp-header">Clinical Communication Platform (CCP)</span>
</header>
<router-outlet></router-outlet>
Expand All @@ -9,6 +9,6 @@
<div>
Made with ♥ and <a href="https://git.verbis.dkfz.de/torbens-prototypen/lens">samply/lens-core</a>.
</div>
<p-image [src]="'/assets/logo-dkfz.svg'" alt="DKFZ"></p-image>
<p-image [src]="'assets/logo-dkfz.svg'" alt="DKFZ"></p-image>
<div></div>
</footer>
Loading

0 comments on commit d89d5f1

Please sign in to comment.