diff --git a/docker-compose.yml b/docker-compose.yml index af2f4c18f..084e1416d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -169,3 +169,13 @@ services: command: -r us -j --no-stats --no-docker-events --skipByName '.*jhipster-registry.*' volumes: - /var/run/docker.sock:/var/run/docker.sock + + ui: + restart: unless-stopped + image: ${DOCKER_REG}/ui:${TAG:-1} + environment: + - 'SPRING_PROFILES_ACTIVE=prod' + volumes: + - ${LOG_VOLUME:-/var/tmp/}:/logs + ports: + - 4200:4200 diff --git a/ui/Dockerfile b/ui/Dockerfile new file mode 100644 index 000000000..48ddb0e98 --- /dev/null +++ b/ui/Dockerfile @@ -0,0 +1,33 @@ +FROM node:20.7.0-bullseye-slim + +# Create app directory +WORKDIR /app + +# Install some useful utils for debug/test +RUN \ + apt-get update && \ + apt -y install procps iproute2 net-tools curl iputils-ping vim && \ + rm -rf /var/lib/apt/lists/* + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied +# where available (npm@5+) +COPY package*.json ./ + +COPY container-files/* /var/tmp/ + +RUN \ + chmod +x /var/tmp/* && \ + npm install + +# If you are building your code for production +# RUN npm install --only=production + +# Bundle app source +COPY . . + +RUN npm run build + +EXPOSE 4200 + +ENTRYPOINT /var/tmp/entrypoint.sh diff --git a/ui/README.md b/ui/README.md index 8cfd15e8e..0a9fd9d2c 100644 --- a/ui/README.md +++ b/ui/README.md @@ -6,6 +6,10 @@ This project was generated with [Angular CLI](https://github.com/angular/angular Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. +Run `npm run start` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. + +Run `npm run start_ssl` for a dev server using https. Navigate to `https://localhost:4200/`. The application will automatically reload if you change any of the source files. + ## Code scaffolding Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. diff --git a/ui/container-files/entrypoint.sh b/ui/container-files/entrypoint.sh new file mode 100644 index 000000000..f93b1d9a2 --- /dev/null +++ b/ui/container-files/entrypoint.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# The NPM "start" command/script is defined in the package.json file in the "scripts" dict +npm start diff --git a/ui/package.json b/ui/package.json index c426db9f4..8e12d215f 100644 --- a/ui/package.json +++ b/ui/package.json @@ -3,9 +3,10 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve", - "build": "ng build", - "watch": "ng build --watch --configuration development", + "start": "ng serve --disable-host-check --host 0.0.0.0", + "start_ssl": "ng serve --disable-host-check --host 0.0.0.0 --ssl", + "build": "ng build --base-href ./", + "watch": "ng build --base-href ./ --watch --configuration development", "test": "ng test" }, "private": true, diff --git a/ui/src/index.html b/ui/src/index.html index 270ac5d73..91d49286c 100644 --- a/ui/src/index.html +++ b/ui/src/index.html @@ -3,7 +3,7 @@