Skip to content

Commit

Permalink
Merge branch 'dev' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Aug 14, 2024
2 parents 3a088ce + 0e346dd commit 65d99df
Show file tree
Hide file tree
Showing 12 changed files with 19,613 additions and 18,640 deletions.
34 changes: 21 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
### STAGE 1: Build ###
# STAGE 1: Build

# We label our stage as 'builder'
FROM node:19-alpine3.15 as builder
FROM node:20-alpine3.20 AS builder

# Copy package.json and package-lock.json
COPY package.json package-lock.json ./

COPY package.json ./

# Set npm configuration to optimize performance
RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

# Update and install required packages
RUN apk update && apk upgrade && apk add --no-cache bash git openssh
## 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

# Install node modules
RUN npm install && mkdir /ng-app && cp -R ./node_modules ./ng-app

# Set working directory
WORKDIR /ng-app

# Copy all files to the working directory
COPY . .

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

### STAGE 2: Setup ###
### STAGE 2: Setup
FROM nginx:1.26.1-alpine

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

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

# Create directory for the web application
RUN mkdir -p /usr/share/nginx/html/portal/webapp
## From 'builder' stage copy over the artifacts in dist folder to default nginx public folder

# Copy built Angular artifacts to nginx public folder
COPY --from=builder /ng-app/dist /usr/share/nginx/html/portal/webapp

CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/portal/webapp/static/webapp/assets/environment/env.template.js> /usr/share/nginx/html/portal/webapp/static/webapp/assets/environment/env.js && exec nginx -g 'daemon off;'"]
# Start nginx server
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/portal/webapp/static/webapp/assets/environment/env.template.js> /usr/share/nginx/html/portal/webapp/static/webapp/assets/environment/env.js && exec nginx -g 'daemon off;'"]
27 changes: 12 additions & 15 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist",
"outputPath": {
"base": "dist"
},
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"polyfills": [
"src/polyfills.ts"
],
"assets": [
"src/static/webapp",
"src/manifest.json"
Expand All @@ -29,14 +32,13 @@
],
"stylePreprocessorOptions": {
"includePaths": [
"./node_modules"
"./node_modules",
"."
]
},
"scripts": [
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": {
"scripts": true,
Expand All @@ -48,13 +50,12 @@
"inlineCritical": false
}
},
"namedChunks": true
"namedChunks": true,
"browser": "src/main.ts"
},
"configurations": {
"development": {
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
Expand All @@ -80,8 +81,6 @@
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
Expand Down Expand Up @@ -109,9 +108,7 @@
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
"extractLicenses": true
}
},
"defaultConfiguration": "custom"
Expand Down
Loading

0 comments on commit 65d99df

Please sign in to comment.