Skip to content

Commit

Permalink
init project vindr-lab-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
HoAnhVan committed Mar 26, 2021
1 parent b393515 commit 93081b7
Show file tree
Hide file tree
Showing 98 changed files with 39,449 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
47 changes: 47 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.job-build-docker-image: &build-docker-image
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
before_script:
- apk add python3 py-pip
- echo ${DOCKERHUB_PASSWORD} | docker login --username ${DOCKERHUB_USERNAME} --password-stdin
- export DOCKER_IMAGE_NAME=vindr/vinlab-dashboard:latest

image: node:lts

cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/

before_script:
- ls -la .
- node -v

stages:
- build-docker-image

build-docker-image:latest:
<<: *build-docker-image
stage: build-docker-image
only:
- master
- develop
- cicd
- open_source
script:
- docker build -t ${DOCKER_IMAGE_NAME} .
- docker push ${DOCKER_IMAGE_NAME}

build-docker-image:tags:
<<: *build-docker-image
stage: build-docker-image
only:
- tags
script:
- docker build -t ${DOCKER_IMAGE_NAME}:${CI_COMMIT_REF_NAME} .
- docker push ${DOCKER_IMAGE_NAME}:${CI_COMMIT_REF_NAME}
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# FROM node:10-alpine as builder

# # install and cache app dependencies
# COPY package.json ./
# RUN npm install && mkdir /app && mv ./node_modules ./app

# WORKDIR /app

# COPY . .

# RUN npm run build:prod



# # ------------------------------------------------------
# # Production Build
# # ------------------------------------------------------

# FROM nginx:1.16.0-alpine
# COPY --from=builder /app/build /usr/share/nginx/html
# RUN rm /etc/nginx/conf.d/default.conf
# COPY nginx/nginx.conf /etc/nginx/conf.d
# EXPOSE 80
# CMD ["nginx", "-g", "daemon off;"]

FROM node:14.14.0-stretch

RUN apt-get update && apt-get install nginx -y

WORKDIR /app

COPY package*.json /app/
RUN npm install
COPY ./ /app/
COPY ./nginx.conf /etc/nginx/sites-enabled/default
RUN chmod +x run.sh

CMD ["./run.sh"]
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<img src="./src/assets/icons/vindr_lab_logo.png" width="256"/>

# VinDr Lab / Dashboard
Vindr Lab Dashboard is a part of the VinLab project. It allows users to manage Projects, Labels, Task, Export label, Upload DICOM files and many more features.

## Developing
The Vindr Lab project consists of two parts. So let's clone and run both projects together.
- [Vindr Lab Dashboard][vindr-lab-dashboard-url]: To manage Projects, Study list, Label, setting, Export label,...
- [Vindr Lab Viewer][vindr-lab-viewer-url]: For viewing medical images, labeling (bounding box, polygon, segment).

### Requirements

- [Yarn 1.17.3+](https://yarnpkg.com/en/docs/install)
- [Node 10+](https://nodejs.org/en/)
- Yarn Workspaces should be enabled on your machine:
- `yarn config set workspaces-experimental true`

### Getting Started

1. [Fork this repository][how-to-fork]
2. [Clone your forked repository][how-to-clone]
- `git clone https://github.com/YOUR-USERNAME/vindr-lab-dashboard.git`
3. Navigate to the cloned project's directory
4. Add this repo as a `remote` named `upstream`
- `git remote add upstream https://github.com/vinbigdata-medical/vindr-lab-dashboard.git`
5. `yarn install` to restore dependencies and link projects

## Commands

These commands are available from the root directory.

| Yarn Commands | Description |
| ---------------------------- | ------------------------------------------------------------- |
| **Develop** | |
| `start` | Default development experience for Dashboard |
| **Deploy** | |
| `build` or `build:prod` | Builds production environment |
| `build:stg` | Builds staging environment |
| `build:dev` | Builds Builds develop environment |


## Projects Architecture

```bash
.
├── public #
├── src #
│ ├── assets # images and icons
│ ├── components # Reusable React components
│ ├── utils # locale, helpers, constants and service files
│ └── view #
├── ... # misc. shared configuration
├── package.json # Shared devDependencies and commands
└── README.md # This file
```

## Acknowledgement

**Note:** If you use or find this repository helpful, please take the time to star this repository on Github. This is an easy way for us to assess adoption and it can help us obtain future funding for the project.

This work is supported primarily by [Vingroup Big Data Institute](http://vinbigdata.org/)
## License

[MIT License](https://github.com/vinbigdata-medical/vinlab-sites/blob/master/LICENSE)

<!-- prettier-ignore-start -->
<!-- Links -->
[vindr-lab-dashboard-url]: https://github.com/vinbigdata-medical/vindr-lab-dashboard
[vindr-lab-viewer-url]: https://github.com/vinbigdata-medical/vindr-lab-viewer
<!-- prettier-ignore-end -->
55 changes: 55 additions & 0 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const CracoLessPlugin = require('craco-less');
const webpack = require('webpack');

let buildMode = 'local';
if (process.argv.indexOf('dev') > -1) buildMode = 'dev';
if (process.argv.indexOf('prod') > -1) buildMode = 'prod';
if (process.argv.indexOf('stg') > -1) buildMode = 'stg';
const raw = Object.keys(process.env).reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
BUILD_TIME: new Date(),
BUILD_USERNAME: process.env.USERNAME,
BUILD_MODE: buildMode,
}
);

module.exports = {
babel: {
plugins: [
['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }],
],
},
webpack: {
plugins: [
new webpack.DefinePlugin({
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
}),
],
configure: (webpackConfig, { env, paths }) => {
return webpackConfig;
},
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: {
'@primary-color': '#17B978',
'@text-selection-bg': '#1890ff',
},
javascriptEnabled: true,
},
},
},
},
],
};
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.7'

services:
app:
container_name: app
build:
context: .
dockerfile: Dockerfile
volumes:
- '.:/app'
- '/app/node_modules'
ports:
- '3000:3000'
environment:
- NODE_ENV=development
8 changes: 8 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
server_name _;
listen 80;
location / {
root /var/www/html/;
try_files $uri $uri/ /index.html;
}
}
13 changes: 13 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
Loading

0 comments on commit 93081b7

Please sign in to comment.