mirror of
https://github.com/Dvorinka/excalidraw-full.git
synced 2026-06-03 22:02:57 +00:00
fix
This commit is contained in:
@@ -11,32 +11,7 @@ env:
|
|||||||
OWNER: betterandbetterii
|
OWNER: betterandbetterii
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-frontend:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Apply frontend patch
|
|
||||||
run: |
|
|
||||||
cd excalidraw
|
|
||||||
git apply ../frontend.patch
|
|
||||||
|
|
||||||
- name: Build frontend
|
|
||||||
run: |
|
|
||||||
docker build -t excalidraw-ui-build excalidraw -f ui-build.Dockerfile
|
|
||||||
docker run -v ${PWD}/:/pwd/ excalidraw-ui-build cp -r /frontend /pwd
|
|
||||||
|
|
||||||
- name: Upload frontend artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: frontend/
|
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
needs: build-frontend
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -48,12 +23,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Download frontend artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: frontend
|
|
||||||
path: frontend/
|
|
||||||
|
|
||||||
- name: Log in to Container Registry
|
- name: Log in to Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -39,35 +39,47 @@ These flexible configurations ensure Excalidraw Complete fits seamlessly into yo
|
|||||||
|
|
||||||
Interested in contributing or customizing? Build Excalidraw Complete from source with these steps:
|
Interested in contributing or customizing? Build Excalidraw Complete from source with these steps:
|
||||||
|
|
||||||
|
### Using Docker (Recommended)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repository with submodules
|
||||||
|
git clone https://github.com/PatWie/excalidraw-complete.git --recursive
|
||||||
|
cd excalidraw-complete
|
||||||
|
|
||||||
|
# Build the Docker image (includes frontend and backend)
|
||||||
|
docker build -t excalidraw-complete -f excalidraw-complete.Dockerfile .
|
||||||
|
|
||||||
|
# Run the container
|
||||||
|
docker run -p 3002:3002 excalidraw-complete
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone and prepare the Excalidraw frontend
|
# Clone and prepare the Excalidraw frontend
|
||||||
git clone https://github.com/PatWie/excalidraw-complete.git --recursive
|
git clone https://github.com/PatWie/excalidraw-complete.git --recursive
|
||||||
cd ./excalidraw-complete/excalidraw
|
cd ./excalidraw-complete/excalidraw
|
||||||
|
|
||||||
# git checkout tags/v0.17.3
|
# Apply frontend patches
|
||||||
# Fix docker build (fix already implemented upstream)
|
|
||||||
# git remote add jcobol https://github.com/jcobol/excalidraw
|
|
||||||
# git fetch jcobol
|
|
||||||
# git checkout 7582_fix_docker_build
|
|
||||||
|
|
||||||
# Adjust URLs inside of frontend.patch if you want to use a reverse proxy
|
|
||||||
git apply ../frontend.patch
|
git apply ../frontend.patch
|
||||||
cd ../
|
|
||||||
git checkout dev
|
# Build frontend
|
||||||
docker build -t exalidraw-ui-build excalidraw -f ui-build.Dockerfile
|
npm install
|
||||||
docker run -v ${PWD}/:/pwd/ -it exalidraw-ui-build cp -r /frontend /pwd
|
cd excalidraw-app
|
||||||
|
npm run build:app:docker
|
||||||
|
cd ../../
|
||||||
|
|
||||||
|
# Copy frontend build to correct location
|
||||||
|
cp -r excalidraw/excalidraw-app/build frontend/
|
||||||
|
|
||||||
|
# Build Go application
|
||||||
|
go build -o excalidraw-complete main.go
|
||||||
```
|
```
|
||||||
|
|
||||||
(Optional) Replace `localhost:3002` inside of `main.go` with your domain name if you want to use a reverse proxy
|
(Optional) Replace `localhost:3002` inside of `main.go` with your domain name if you want to use a reverse proxy
|
||||||
(Optional) Replace `"ssl=!0", "ssl=0"` with `"ssl=!0", "ssl=1"` if you want to use HTTPS
|
(Optional) Replace `"ssl=!0", "ssl=0"` with `"ssl=!0", "ssl=1"` if you want to use HTTPS
|
||||||
(Optional) Replace `"ssl:!0", "ssl:0"` with `"ssl:!0", "ssl:1"` if you want to use HTTPS
|
(Optional) Replace `"ssl:!0", "ssl:0"` with `"ssl:!0", "ssl:1"` if you want to use HTTPS
|
||||||
|
|
||||||
Compile the Go application:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
go build -o excalidraw-complete main.go
|
|
||||||
```
|
|
||||||
|
|
||||||
Declare environment variables if you want any (see section above)
|
Declare environment variables if you want any (see section above)
|
||||||
Example: `STORAGE_TYPE=sqlite DATA_SOURCE_NAME=/tmp/excalidb.sqlite`
|
Example: `STORAGE_TYPE=sqlite DATA_SOURCE_NAME=/tmp/excalidb.sqlite`
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,35 @@
|
|||||||
FROM golang:alpine as builder
|
# 前端构建阶段
|
||||||
|
FROM node:18 AS frontend-builder
|
||||||
|
WORKDIR /app
|
||||||
|
# 复制 excalidraw 子模块
|
||||||
|
COPY excalidraw/ ./excalidraw/
|
||||||
|
# 复制补丁文件
|
||||||
|
COPY frontend.patch ./
|
||||||
|
# 应用前端补丁
|
||||||
|
RUN cd excalidraw && git apply ../frontend.patch
|
||||||
|
# 构建前端
|
||||||
|
RUN cd excalidraw && npm install && cd excalidraw-app && npm run build:app:docker
|
||||||
|
|
||||||
|
# 后端构建阶段
|
||||||
|
FROM golang:alpine AS backend-builder
|
||||||
RUN apk update && apk add --no-cache git
|
RUN apk update && apk add --no-cache git
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY go.mod ./
|
# 复制 Go 模块文件
|
||||||
|
COPY go.mod go.sum ./
|
||||||
RUN GOPROXY=direct go mod download
|
RUN GOPROXY=direct go mod download
|
||||||
|
# 复制源代码
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# 复制前端构建文件到正确位置,以便 Go embed 可以找到
|
||||||
|
COPY --from=frontend-builder /app/excalidraw/excalidraw-app/build ./frontend/
|
||||||
|
# 构建 Go 应用
|
||||||
RUN GOPROXY=direct CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
|
RUN GOPROXY=direct CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
|
||||||
|
|
||||||
FROM alpine
|
# 最终运行镜像
|
||||||
|
FROM alpine:latest
|
||||||
|
RUN apk --no-cache add ca-certificates
|
||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
COPY --from=builder /app/main .
|
# 复制后端二进制文件(已包含嵌入的前端文件)
|
||||||
# COPY --from=builder /app/.env .
|
COPY --from=backend-builder /app/main .
|
||||||
|
# 暴露端口
|
||||||
EXPOSE 3002
|
EXPOSE 3002
|
||||||
CMD ["./main"]
|
CMD ["./main"]
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
FROM node:18 AS build
|
|
||||||
|
|
||||||
WORKDIR /home/node/app
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
RUN cd excalidraw-app && npm run build:app:docker
|
|
||||||
|
|
||||||
FROM ubuntu:20.04
|
|
||||||
COPY --from=build /home/node/app/excalidraw-app/build /frontend
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user