-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
更换后端alpine基础镜像3.18旧版本,新版本导致sqlite3报错
- Loading branch information
Showing
1 changed file
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
# build front-end | ||
# build frontend | ||
FROM node AS web_image | ||
|
||
# 华为源 | ||
# RUN npm config set registry https://repo.huaweicloud.com/repository/npm/ | ||
|
||
RUN npm install pnpm -g | ||
|
||
WORKDIR /build | ||
|
@@ -16,24 +19,30 @@ COPY . /build | |
RUN pnpm run build | ||
|
||
# build backend | ||
FROM golang:1.21-alpine as server_image | ||
# 最新alpine3.19导致sqlite3编译失败(https://github.com/mattn/go-sqlite3/issues/1164, | ||
# 临时解决方案:https://github.com/mattn/go-sqlite3/pull/1177) | ||
# sun-panel暂时解决方案使用golang:1.21-alpine3.18(因旧版本使用没问题,短期内较稳定) | ||
FROM golang:1.21-alpine3.18 as server_image | ||
|
||
WORKDIR /build | ||
|
||
COPY ./service . | ||
|
||
RUN apk add --no-cache bash curl gcc git go musl-dev | ||
# 中国国内源 | ||
# RUN sed -i "[email protected]@mirrors.aliyun.com@g" /etc/apk/repositories \ | ||
# && go env -w GOPROXY=https://goproxy.cn,direct | ||
|
||
RUN apk add --no-cache bash curl gcc git musl-dev | ||
|
||
RUN go env -w GO111MODULE=on \ | ||
# && go env -w GOPROXY=https://goproxy.cn,direct \ | ||
&& export PATH=$PATH:/go/bin \ | ||
&& go install -a -v github.com/go-bindata/go-bindata/...@latest \ | ||
&& go install -a -v github.com/elazarl/go-bindata-assetfs/...@latest \ | ||
&& go-bindata-assetfs -o=assets/bindata.go -pkg=assets assets/... \ | ||
&& go build -o sun-panel --ldflags="-X sun-panel/global.RUNCODE=release -X sun-panel/global.ISDOCKER=docker" main.go | ||
|
||
|
||
|
||
# run_image | ||
FROM alpine | ||
|
||
|
@@ -43,6 +52,9 @@ COPY --from=web_image /build/dist /app/web | |
|
||
COPY --from=server_image /build/sun-panel /app/sun-panel | ||
|
||
# 中国国内源 | ||
# RUN sed -i "[email protected]@mirrors.aliyun.com@g" /etc/apk/repositories | ||
|
||
RUN apk add --no-cache bash ca-certificates su-exec tzdata \ | ||
&& chmod +x ./sun-panel \ | ||
&& ./sun-panel -config | ||
|