File tree 6 files changed +62
-30
lines changed
6 files changed +62
-30
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,11 @@ jobs:
23
23
with :
24
24
node-version : 21
25
25
- name : Build
26
- run : ./scripts.sh build
27
- - name : Release
28
- uses : softprops/action-gh-release@v1
26
+ run : |
27
+ ./scripts.sh build
28
+ - name : Run GoReleaser
29
+ uses : goreleaser/goreleaser-action@v5
29
30
with :
30
- draft : true
31
- files : |
32
- build/*
31
+ distribution : goreleaser
32
+ version : latest
33
+ args : release --clean
Original file line number Diff line number Diff line change
1
+ # project_name: fusion
2
+ dist : ./build
3
+ builds :
4
+ - env :
5
+ - CGO_ENABLED=0
6
+ goos :
7
+ - linux
8
+ - windows
9
+ - darwin
10
+ goarch :
11
+ - amd64
12
+ - " 386"
13
+ - arm64
14
+ ignore :
15
+ - goos : darwin
16
+ goarch : " 386"
17
+ binary : fusion
18
+ main : ./cmd/server
19
+
20
+ archives :
21
+ - id : default
22
+ format : zip
23
+
24
+ checksum :
25
+ algorithm : sha256
26
+ name_template : " checksums.txt"
27
+
28
+ snapshot :
29
+ name_template : " {{ incpatch .Version }}-next"
30
+
31
+ changelog :
32
+ use : github
33
+
34
+ release :
35
+ draft : true
Original file line number Diff line number Diff line change 1
- # build backend
2
- FROM golang:1.22 as be
3
- WORKDIR /src
4
- COPY . ./
5
- RUN go build -o fusion-server ./cmd/server/*
6
-
7
1
# build frontend
8
2
FROM node:21 as fe
9
3
WORKDIR /src
10
4
COPY ./frontend ./
11
5
RUN npm i && npm run build
12
6
7
+ # build backend
8
+ FROM golang:1.22 as be
9
+ WORKDIR /src
10
+ COPY . ./
11
+ COPY --from=fe /src/build ./frontend/build/
12
+ RUN go build -o fusion ./cmd/server/*
13
+
13
14
# deploy
14
15
FROM debian:12
15
16
RUN apt-get update && apt-get install -y sqlite3
16
17
WORKDIR /fusion
17
18
COPY .env ./
18
- COPY --from=be /src/fusion-server ./
19
- COPY --from=fe /src/build ./frontend/
19
+ COPY --from=be /src/fusion ./
20
20
EXPOSE 8080
21
21
RUN mkdir /data
22
22
ENV DB="/data/fusion.db"
23
- CMD [ "./fusion-server " ]
23
+ CMD [ "./fusion" ]
24
24
Original file line number Diff line number Diff line change @@ -23,23 +23,17 @@ Or you can build docker image from scratch:
23
23
docker build -t rook1e404/fusion .
24
24
```
25
25
26
- ### 2. Pre-build
26
+ ### 2. Pre-build binary
27
27
28
- Download an release, then run:
28
+ Download an release, edit ` .env ` , then run:
29
29
30
30
``` shell
31
- ./fusion-server
31
+ ./fusion
32
32
```
33
33
34
34
### 3. Build from source
35
35
36
- 1 . Prepare dependencies
37
-
38
- ``` shell
39
- go mod tidy
40
- cd frontend && npm i
41
- ```
42
-
36
+ 1 . Prepare dependencies: Go 1.22, Node 21 with NPM
43
37
2 . Build
44
38
45
39
``` shell
@@ -54,7 +48,7 @@ cd build
54
48
# edit .env
55
49
56
50
# run
57
- ./fusion-server
51
+ ./fusion
58
52
```
59
53
60
54
## ToDo
Original file line number Diff line number Diff line change 5
5
"io/fs"
6
6
)
7
7
8
+ // This embed only used in production. Only APIs are used in development,
9
+ // so no error
10
+
8
11
//go:embed all:build
9
12
var build embed.FS
10
13
Original file line number Diff line number Diff line change 3
3
build () {
4
4
root=$( pwd)
5
5
rm -r ./build
6
- mkdir -p ./build/frontend
7
- echo " building backend"
8
- cp .env build/
9
- go build -o ./build/fusion-server ./cmd/server/* || exit 1
10
6
echo " building frontend"
11
7
cd ./frontend && npm i && npm run build && cp -R ./build/ $root /build/frontend || exit 1
12
8
cd $root || exit 1
9
+ echo " building backend"
10
+ cp .env build/
11
+ go build -o ./build/fusion ./cmd/server/* || exit 1
13
12
}
14
13
15
14
gen () {
You can’t perform that action at this time.
0 commit comments