File tree 2 files changed +26
-13
lines changed
2 files changed +26
-13
lines changed Original file line number Diff line number Diff line change 1
1
# build frontend
2
2
FROM node:22 as fe
3
3
WORKDIR /src
4
- COPY .git frontend ./
5
- RUN npm i && npm run build
4
+ COPY .git .git/
5
+ COPY frontend ./frontend
6
+ COPY scripts.sh .
7
+ RUN ./scripts.sh build-frontend
6
8
7
9
# build backend
8
10
FROM golang:1.23 as be
9
11
WORKDIR /src
10
12
COPY . ./
11
- COPY --from=fe /src/build ./frontend/build/
12
- RUN go build -o fusion ./cmd/server/*
13
+ COPY --from=fe /src/frontend/ build ./frontend/build/
14
+ RUN ./scripts.sh build-backend
13
15
14
16
# deploy
15
17
FROM debian:12
16
18
LABEL org.opencontainers.image.source="https://github.com/0x2E/fusion"
17
19
RUN apt-get update && apt-get install -y sqlite3 ca-certificates
18
20
WORKDIR /fusion
19
- COPY --from=be /src/fusion ./
21
+ COPY --from=be /src/build/ fusion ./
20
22
EXPOSE 8080
21
23
RUN mkdir /data
22
24
ENV DB="/data/fusion.db"
23
25
CMD [ "./fusion" ]
24
-
Original file line number Diff line number Diff line change @@ -8,29 +8,35 @@ gen() {
8
8
}
9
9
10
10
test_go () {
11
+ echo " testing"
11
12
gen
12
13
# make some files for embed
13
14
mkdir -p ./frontend/build
14
15
touch ./frontend/build/index.html
15
16
go test ./...
16
17
}
17
18
18
- build () {
19
- echo " testing"
20
- gen
21
- test_go
22
-
23
- root=$( pwd)
24
- mkdir -p ./build
19
+ build_frontend () {
25
20
echo " building frontend"
21
+ mkdir -p ./build
22
+ root=$( pwd)
26
23
cd ./frontend
27
24
npm i
28
25
npm run build
29
26
cd $root
27
+ }
28
+
29
+ build_backend () {
30
30
echo " building backend"
31
31
go build -o ./build/fusion ./cmd/server/*
32
32
}
33
33
34
+ build () {
35
+ test_go
36
+ build_frontend
37
+ build_backend
38
+ }
39
+
34
40
dev () {
35
41
gen
36
42
go run ./cmd/server
@@ -46,6 +52,12 @@ case $1 in
46
52
" dev" )
47
53
dev
48
54
;;
55
+ " build-frontend" )
56
+ build_frontend
57
+ ;;
58
+ " build-backend" )
59
+ build_backend
60
+ ;;
49
61
" build" )
50
62
build
51
63
;;
You can’t perform that action at this time.
0 commit comments