Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker readme #71

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions client/Dockerfile

This file was deleted.

39 changes: 39 additions & 0 deletions client/wfprev-war/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#Step 1: Build the Angular app
FROM node:18 AS build

WORKDIR /src/main/angular

# Add NPM Token from build arguments for private registry authentication
ARG NPM_TOKEN
ARG PRIVATE_REGISTRY_AUTH
RUN echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
RUN echo "//bwa.nrs.gov.bc.ca/int/artifactory/api/npm/nrs-virtual-npm/:_auth=${PRIVATE_REGISTRY_AUTH}" >> .npmrc

# Copy the package.json and package-lock.json files
COPY src/main/angular/package*.json ./

# Clean the npm cache before installing dependencies
RUN npm cache clean --force

# Remove node_modules and package-lock.json if they exist (optional cleanup)
RUN rm -rf node_modules package-lock.json

# Install npm dependencies
RUN npm install

# Copy the rest of the Angular project files
COPY src/main/angular ./

# Build the Angular project (use --configuration=production instead of --prod)
RUN npm run build --configuration=production

# Step 2: Serve the app with nginx
FROM nginx:alpine

# Copy the built Angular app to Nginx
COPY --from=build /src/main/angular/dist/wfprev/* /usr/share/nginx/html
# Expose port 80
EXPOSE 80

# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]
22 changes: 22 additions & 0 deletions client/wfprev-war/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# WFPrev UI - Docker Setup Guide

This document provides instructions for building and running the WFPrev UI using Docker.

## Prerequisites

Make sure you have the following installed before proceeding:

- **Docker**: Download and install [Docker](https://www.docker.com/products/docker-desktop) on your machine.
- **NPM Authentication Tokens**: If your project requires private npm packages, you will need access to the necessary tokens.

## Steps to Run the UI with Docker

### Build the Docker Image, run following command under wfprev-war folder where dockerfile locates. npm-token and registry-token can be retrieve from your npmrc
docker build -t wfprev-ui --build-arg NPM_TOKEN=<your-npm-token> --build-arg PRIVATE_REGISTRY_AUTH=<your-private-registry-token> .

Then you should see a wfprev-ui appears in your images list.

### Run the image using following command.
docker run -d -p 8080:80 --name wfprev-ui-container wfprev-ui

### Verify the UI is running by opening the browser and navigate to localhost:8080
1 change: 1 addition & 0 deletions client/wfprev-war/src/main/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"rollup": "^4.21.3",
"storybook": "^8.2.9",
"typescript": "~5.4.5"
}
Expand Down
Loading