Skip to content
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
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
package-lock=false
scripts-prepend-node-path=true
registry=https://registry.npm.taobao.org
sass-binary-site=https://npm.taobao.org/mirrors/node-sass
43 changes: 43 additions & 0 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM node:12-alpine as builder
MAINTAINER sunnyw <sunnywang@yunify.com>

ENV SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass
ENV PATH=$PATH:/home/node_modules/.bin

WORKDIR /home/app

RUN mkdir -p /home/app

RUN npm config set registry https://registry.npm.taobao.org

COPY package.json yarn.lock /tmp/

# generate dev node modules and prod node modules
RUN cd /tmp && mkdir -p node_modules \
&& yarn install --pure-lockfile --prefer-offline \
&& mv node_modules dev_node_modules \
&& NODE_ENV=production yarn install --pure-lockfile --prod --prefer-offline \
&& mv node_modules prod_node_modules \
&& mv dev_node_modules node_modules

COPY . /home/app

RUN cd /home/app && \
ln -fs /tmp/node_modules && \
yarn prod:build


FROM yobasystems/alpine-nodejs:min-aarch64

ENV NODE_ENV=production

WORKDIR /home/app

RUN mkdir -p /home/app

COPY --from=builder /home/app /home/app
COPY --from=builder /tmp/prod_node_modules /home/app/node_modules

EXPOSE 8000

CMD ["npm", "run", "prod:serve"]
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ docker-tag:
docker build --cache-from ${repo}:latest -t ${repo}:${tag} .
docker push ${repo}:${tag}

build-arm: Dockerfile.arm
@echo building image for ARM platform
docker build -f Dockerfile.arm -t op/web-app-arm .

run-arm:
@echo up and running openpitrix-dashboard in ARM platform
docker run -p 8000:8000 --rm \
--name openpitrix-dashboard-arm \
-v "$(cwd)"/server/local_config.yml:/home/app/server/local_config.yml op/web-app-arm
45 changes: 33 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,50 @@
```
git clone https://github.com/openpitrix/dashboard.git
cd dashboard
yarn
yarn
yarn dev
```

Or you can running dashboard in `docker`:
## Docker

You can run dashboard in `docker`:

```
docker pull openpitrix/dashboard
docker run -d --name openpitrix-dashborad -p 8000:8000 openpitrix/dashboard
docker run -d --rm --name openpitrix-dashborad -p 8000:8000 openpitrix/dashboard
```

Then open your favorite browser: `http://localhost:8000`

## Build for ARM platform

We also support running `openpitrix/dashboard` in ARM platform using docker

See build steps in `Dockerfile.arm`

If you want try local build for ARM:

```
make build-arm
make run-arm
```

Or running our official arm64 image from docker hub:

```
docker pull openpitrix/dashboard:min-arm64
docker run -d --rm --name openpitrix-dashborad-arm -p 8000:8000 openpitrix/dashboard:min-arm64
```
Then open your browser: `http://localhost:8000`

## Develop

```
yarn
yarn
yarn dev
```

We prefer `yarn` as our package manager, if you like `npm`:

```
npm i
npm run dev
Expand All @@ -41,26 +66,22 @@ npm run dev
See [How to install requsites](./docs/install.md)

## Test

```
yarn test
```

## Build

For production build:

```
yarn prod:build
```
Or using `npm`:
```
npm run prod:build
```


## Quick start

* [Deploy wordpress on QingCloud using openpitrix](./docs/quick-start.md)

- [Deploy wordpress on QingCloud using openpitrix](./docs/quick-start.md)

## License

Expand Down
9 changes: 5 additions & 4 deletions deploy-docker.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bash

set -e
set -ex

REPO=openpitrix/dashboard
COMMIT=$(git rev-parse --short HEAD)
TAG=${1:-latest}

echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
cat ~/docker_pass.txt | docker login --username iwisunny --password-stdin

echo "Pulling remote latest image to reuse docker cache"
docker pull $REPO:latest
Expand All @@ -14,7 +15,7 @@ echo "Building docker image from git HEAD commit: $COMMIT"
docker build --cache-from $REPO:latest -t $REPO:$COMMIT .

echo "Tag $REPO:$COMMIT as latest image"
docker tag $REPO:$COMMIT $REPO:latest
docker tag $REPO:$COMMIT $REPO:$TAG

echo "Push latest image to docker hub"
docker push $REPO:latest
docker push $REPO:$TAG
Loading