Skip to content

开源白板工具(SaaS),一体化白板,包含思维导图、流程图、自由画等。All in one open-source whiteboard tool with mind, flowchart, freehand and etc.

ci: a tiny docker image (#127)

renyang@lud440f1c9b0cd
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..0e5b83c
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
+.nx
+.dist
+.node_modules
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..fdaee4f
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,46 @@
+name: publish
+
+on:
+ push:
+ tags:
+ - "*"
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to Docker Registry
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Set TAG
+ run: echo TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
+
+ - name: Publish ${{ matrix.svc }}
+ uses: docker/build-push-action@v3
+ with:
+ file: Dockerfile
+ outputs: "type=registry,push=true"
+ platforms: linux/amd64, linux/arm64
+ tags: |
+ ghcr.io/${{ github.repository_owner }}/drawnix:latest
+ ghcr.io/${{ github.repository_owner }}/drawnix:${{ env.TAG }}
+ pubuzhixing/drawnix:${{ env.TAG }}
+ pubuzhixing/drawnix:latest
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 348bb16..bb42bb6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,19 @@
+FROM node:20 AS builder
-FROM node:latest
+WORKDIR /builder
-WORKDIR /app
-COPY . /app
+COPY . /builder
-RUN npm install
+RUN npm install \
+ && npm run build
-EXPOSE 7200
-CMD ["npm", "run", "start"]
+FROM lipanski/docker-static-website:2.4.0
+
+WORKDIR /home/static
+
+COPY --from=builder /builder/dist/apps/web/ /home/static
+
+EXPOSE 80
+
+CMD ["/busybox-httpd", "-f", "-v", "-p", "80", "-c", "httpd.conf"]
\ No newline at end of file