Skip to content

Commit

Permalink
Merge pull request #946 from gisaia/feature/refactorBuild
Browse files Browse the repository at this point in the history
Feat: refactor release script
  • Loading branch information
QuCMGisaia authored Feb 11, 2025
2 parents 72df700 + af82f9d commit b8814a7
Show file tree
Hide file tree
Showing 50 changed files with 682 additions and 1,051 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,27 @@ jobs:
run: npm run license-check
- name: Test
run: npm run test
- name: Build
- name: Build lib
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
npm install
npm install --workspaces=false --include-workspace-root=true
npm run build-lib
- name: Build cloud
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
npm install --workspace=packages/cloud --include-workspace-root=true
npm rebuild node-sass
npm run build-opensource
npm run build-cloud
npm run build-opensource-lib
npm run build-cloud-lib
- name: Build open source
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
npm install --workspace=packages/opensource --include-workspace-root=true
npm rebuild node-sass
npm run build-opensource
- name: Docker build
run: |
export NODE_OPTIONS=--max_old_space_size=8192;
docker build -f docker/Dockerfile-production-cloud .;
docker build -f docker/Dockerfile-production-opensource .
docker build -f docker/Dockerfile --build-arg WORKSPACE=cloud .;
docker build -f docker/Dockerfile --build-arg WORKSPACE=opensource .
#- name: i18n
# run: ./checki18n.sh
4 changes: 2 additions & 2 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

- name: Build -opensource and cloud- Docker images
run: |
docker build -f docker/Dockerfile-production-cloud -t docker.io/gisaia/arlas-wui-cloud:${{ github.sha }} .
docker build -f docker/Dockerfile-production-opensource -t docker.io/gisaia/arlas-wui:${{ github.sha }} .
docker build -f docker/Dockerfile --build-arg WORKSPACE=cloud -t docker.io/gisaia/arlas-wui-cloud:${{ github.sha }} .
docker build -f docker/Dockerfile --build-arg WORKSPACE=opensource -t docker.io/gisaia/arlas-wui:${{ github.sha }} .
- name: Run Trivy vulnerability scanner on opensource image
uses: aquasecurity/trivy-action@master
env:
Expand Down
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## [v27.0.0-beta.12](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.12) (2025-02-03)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-beta.11...v27.0.0-beta.12)

## [v27.0.0-beta.11](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.11) (2025-01-30)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-beta.10...v27.0.0-beta.11)

**Fixed bugs:**

- Translation throws an error when the color key is not defined for manual colors [\#929](https://github.com/gisaia/ARLAS-wui/issues/929)

## [v27.0.0-beta.10](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.10) (2025-01-29)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-beta.9...v27.0.0-beta.10)

## [v27.0.0-beta.9](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.9) (2025-01-29)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-beta.8...v27.0.0-beta.9)

## [v27.0.0-beta.8](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.8) (2025-01-29)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-beta.7...v27.0.0-beta.8)
Expand All @@ -10,11 +30,7 @@

## [v27.0.0-beta.6](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.6) (2025-01-28)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-beta.9...v27.0.0-beta.6)

## [v27.0.0-beta.9](https://github.com/gisaia/ARLAS-WUI/tree/v27.0.0-beta.9) (2025-01-24)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-rc.2...v27.0.0-beta.9)
[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v27.0.0-rc.2...v27.0.0-beta.6)

**New stuff:**

Expand Down
47 changes: 24 additions & 23 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@
]
},
"configurations": {
"development": {
"optimization": false,
"outputHashing": "all",
"sourceMap": true,
"browser": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"styles": [
"src/styles/variables.scss",
"src/styles/arlas-wui-theme.scss",
"src/styles.scss",
"node_modules/iv-viewer/dist/iv-viewer.css"
],
"namedChunks": true,
"extractLicenses": false,
"budgets": []
},
"development-opensource": {
"optimization": false,
"outputHashing": "all",
Expand Down Expand Up @@ -249,7 +265,7 @@
"buildTarget": "arlas-wui:build:production-opensource"
}
},
"defaultConfiguration": "development-opensource"
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
Expand Down Expand Up @@ -308,35 +324,20 @@
}
}
},
"arlas-wui-opensource-lib": {
"projectType": "library",
"root": "",
"sourceRoot": "src",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"defaultConfiguration": "production-opensource",
"configurations": {
"production-opensource": {
"tsConfig": "tsconfig.lib.prod.opensource.json",
"project": "ng-package.opensource.json"
}
}
}
}
},
"arlas-wui-cloud-lib": {
"arlas-wui-lib": {
"projectType": "library",
"root": "",
"sourceRoot": "src",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"defaultConfiguration": "production-cloud",
"options": {
"tsConfig": "tsconfig.lib.json",
"project": "ng-package.json"
},
"configurations": {
"production-cloud": {
"tsConfig": "tsconfig.lib.prod.cloud.json",
"project": "ng-package.cloud.json"
"production": {
"tsConfig": "tsconfig.lib.prod.json"
}
}
}
Expand Down
37 changes: 19 additions & 18 deletions docker/Dockerfile-production-cloud → docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@

### STAGE 1: Build ###

# We label our stage as 'builder'
FROM node:18.20.5 AS builder
ARG WORKSPACE

COPY ./packages/cloud/package-docker.json ./package.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

COPY ./scripts/start.sh ./ng-app
COPY ./scripts/fetch-conf-by-http.sh ./ng-app

RUN mkdir /ng-app
WORKDIR /ng-app

COPY . .
COPY packages/$WORKSPACE ./packages/$WORKSPACE/
COPY package.json .
COPY package-lock.json .
COPY ./src/ ./src/
COPY angular.json .
COPY tsconfig.json .

## Build the angular app in production mode and store the artifacts in <dist folder>
RUN npm run build-cloud
RUN npm install --ignore-scripts --workspace=packages/$WORKSPACE --include-workspace-root=true && npm run postinstall
## Build the angular app in production mode and store the artifacts in dist folder
RUN npm run build-$WORKSPACE

### STAGE 2: Setup ###

FROM nginx:1.25.3-alpine3.18-slim
ARG version="latest"
RUN chown -R nginx /etc/nginx
RUN chown -R nginx /usr/share/nginx/html
USER nginx

LABEL io.arlas.wui.version=${version}
LABEL vendor="Gisaïa"
LABEL description="This container build and serve the ARLAS-wui app"

RUN apk add --update bash jq netcat-openbsd curl && rm -rf /var/cache/apk/*

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

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

COPY ./scripts/start.sh /usr/share/nginx/

## 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
COPY --from=builder /ng-app/start.sh /usr/share/nginx/
COPY --from=builder /ng-app/fetch-conf-by-http.sh /usr/share/nginx/

HEALTHCHECK CMD curl --fail http://localhost:80/ || exit 1
HEALTHCHECK CMD wget -O /dev/null http://127.0.0.1:8080/ || exit 1

CMD /usr/share/nginx/start.sh
Empty file.
47 changes: 0 additions & 47 deletions docker/Dockerfile-production-opensource

This file was deleted.

15 changes: 0 additions & 15 deletions ng-package.cloud.json

This file was deleted.

2 changes: 1 addition & 1 deletion ng-package.opensource.json → ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"."
],
"lib": {
"entryFile": "src/public-api.opensource.ts"
"entryFile": "src/public-api.ts"
}
}
2 changes: 1 addition & 1 deletion nginx/default.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {

listen 80;
listen 8080;

sendfile on;

Expand Down
37 changes: 37 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /tmp/nginx.pid;


events {
worker_connections 1024;
}


http {
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}
Loading

0 comments on commit b8814a7

Please sign in to comment.