Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lunguyenhat authored Oct 18, 2023
2 parents ee6a43b + c267e61 commit e9ccacc
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 2,957 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**/node_modules
**/npm-debug.log
build
dist
**/build
**/dist
43 changes: 20 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@

## Deps
FROM node:16-alpine AS deps
## builder
FROM node:16-alpine AS builder
WORKDIR /app

COPY .git .
COPY nx.json .
COPY package.json .
COPY yarn.lock .

RUN yarn install --frozen-lockfile --network-timeout 600000

## Builder
FROM node:16-alpine AS builder
WORKDIR /app

# Cache and Install dependencies
COPY --from=deps ./app/node_modules ./node_modules
COPY packages packages

# Copy app files
COPY ./.git ./
COPY ./package.json ./
COPY ./jsconfig.json ./
COPY ./.eslintrc ./
COPY ./babel.config.json ./
COPY ./craco.config.js ./
COPY ./public ./public/
COPY ./src ./src/
RUN apk add --update --no-cache \
make \
g++ \
jpeg-dev \
cairo-dev \
giflib-dev \
pango-dev \
libtool \
autoconf \
automake \
git

ENV GENERATE_SOURCEMAP=false
RUN apk add --no-cache git
RUN yarn install --frozen-lockfile --network-timeout 600000

# Build the app
RUN npx craco build
RUN yarn build

# Bundle static assets
FROM node:16-alpine AS production
WORKDIR /app

# Copy built assets from builder
COPY --from=builder ./app/build ./build
COPY --from=builder app/packages/aesirx-bi-app/build build

RUN yarn add serve react-inject-env

# Expose port
EXPOSE 3000

ENTRYPOINT npx react-inject-env set && npx serve -s build

40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@ Follow the instructions in: [https://github.com/aesirxio/analytics-1stparty/tree

Follow the instructions in: [https://github.com/aesirxio/analytics/tree/master](https://github.com/aesirxio/analytics-1stparty)

### Configure this project

1. Run `yarn install` to install the dependencies.
1. Rename the `.env.dist` file to `.env`.
1. Replace the `REACT_APP_BI_ENDPOINT_URL` in the `.env` file with the link to your `1st party server for AesirX Analytics`.
1. Replace the `REACT_APP_DATA_STREAM` in the `.env` file with the `name` and `domain` to the your data-stream endpoint.
1. Replace the `REACT_APP_DEFAULT_USER` in the `.env` file with the user that you want to set for Login.
1. Replace the `REACT_APP_DEFAULT_PASSWORD` in the `.env` file with the password that you want to set for Login.

### Development

1. Run `yarn dev`
1. Open [http://localhost:3000](http://localhost:3000) - 3000 is `PORT` to view it in the browser.

### Production
##### Run on a webserver
## Development

1. This project is using Monorepos with git submodule. You need to run `git submodule update --init --recursive` after cloned the project.
2. Run `yarn install` to install the dependencies.
3. Run `yarn prepare` to build the dependencies.
2. Rename the `.env.dist` file to `.env`.
3. Replace license keys in the `.env` file with the one provided in your profile account.
1. Replace the `REACT_APP_BI_ENDPOINT_URL` in the `.env` file with the link to your `1st party server for AesirX Analytics`.
1. Replace the `REACT_APP_DATA_STREAM` in the `.env` file with the `name` and `domain` to the your data-stream endpoint.
1. Replace the `REACT_APP_DEFAULT_USER` in the `.env` file with the user that you want to set for Login.
1. Replace the `REACT_APP_DEFAULT_PASSWORD` in the `.env` file with the password that you want to set for Login.
1. `PORT` change the port. Default is 3000

5. Run `yarn dev`
6. Open [http://localhost:3000](http://localhost:3000) - 3000 is `PORT` to view it in the browser.

## Production
Run on a webserver:
1. Run `yarn build` after changed `.env` file.
2. Upload `build` folder to webserver.
2. Upload `packages/aesirx-bi-app/build` folder to webserver.

##### Dockerize
Run `docker compose -f "docker-compose.yml" up -d --build` after changed `.env` file.
### Dockerize
1. Run `docker compose -f "docker-compose.yml" up -d --build` after changed `.env` file.
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
"nx": "16.3.2"
},
"resolutions": {
"@yarnpkg/parsers": "3.0.0-rc.48.1"
"@yarnpkg/parsers": "3.0.0-rc.48.1",
"tough-cookie": "^4",
"semver": "^7",
"jsdom": "^16",
"nth-check": "^2",
"postcss": "^8",
"json5": "^2",
"@types/react": "^18",
"d3-color": "^3"
},
"scripts": {
"prepare": "nx run-many -t build -p aesirx-uikit aesirx-lib && nx run-many -t build:lib --exclude aesirx-uikit aesirx-lib aesirx-bi-app",
Expand Down
Loading

0 comments on commit e9ccacc

Please sign in to comment.