forked from IceBearAI/LLM-And-More
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.all
More file actions
48 lines (37 loc) · 1.55 KB
/
Dockerfile.all
File metadata and controls
48 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Node 打包前端镜像
FROM node:18.16.1-alpine3.18 AS node-dev
COPY ./aigc-server-web /app/web
WORKDIR /app/web
# install packages
RUN npm install pnpm -g --registry https://registry.npmmirror.com/
ARG NODE_OPTIONS=--max_old_space_size=4096
RUN pnpm config set registry https://registry.npmmirror.com/
RUN pnpm install
# build
ARG VITE_LOG_LEVEL=error
RUN pnpm build
# Golang 打包基础镜像
FROM golang:1.21.5 AS build-env
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn
ENV BUILDPATH=github.com/IceBearAI/aigc
ENV GOINSECURE=github.com/IceBear-CreditEase-LLM
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN mkdir -p /go/src/${BUILDPATH}
COPY . /go/src/${BUILDPATH}
COPY --from=node-dev /app/web/dist /go/src/${BUILDPATH}/web
WORKDIR /go/src/${BUILDPATH}/
RUN go build -o /go/bin/aigc-server -ldflags="-X 'github.com/IceBearAI/aigc/cmd/service.version=$(git describe --tags --always --dirty)' \
-X 'github.com/IceBearAI/aigc/cmd/service.buildDate=$(date +%FT%T%z)' \
-X 'github.com/IceBearAI/aigc/cmd/service.gitCommit=$(git rev-parse --short HEAD)' \
-X 'github.com/IceBearAI/aigc/cmd/service.gitBranch=$(git rev-parse --abbrev-ref HEAD)'" ./cmd/main.go
# 运行镜像
FROM alpine:latest
# ffmpeg 用于音频处理
#RUN apk add --no-cache ffmpeg
COPY --from=build-env /go/bin/aigc-server /usr/local/aigc-server/bin/aigc-server
WORKDIR /usr/local/aigc-server/
ENV PATH=$PATH:/usr/local/aigc-server/bin/
CMD ["aigc-server", "start"]