1 Star 0 Fork 681

happywzy/bbs-go

forked from 码农俱乐部/bbs-go 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 1.44 KB
一键复制 编辑 原始数据 按行查看 历史
happywzy 提交于 2024-12-24 17:24 . upload
# server builder
FROM golang:1.23 AS server_builder
ENV APP_HOME=/code/bbs-go/server
WORKDIR "$APP_HOME"
COPY ./server ./
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod download
RUN CGO_ENABLED=0 go build -v -o bbs-go main.go && chmod +x bbs-go
# site builder
FROM node:20-alpine AS site_builder
ENV APP_HOME=/code/bbs-go/site
WORKDIR "$APP_HOME"
COPY ./site ./
RUN npm install -g pnpm --registry=https://registry.npmmirror.com
RUN pnpm install --registry=https://registry.npmmirror.com
RUN npm install -g pnpm
RUN pnpm install
RUN pnpm build:docker
# admin builder
FROM node:20-alpine AS admin_builder
ENV APP_HOME=/code/bbs-go/admin
WORKDIR "$APP_HOME"
COPY ./admin ./
RUN npm install -g pnpm --registry=https://registry.npmmirror.com
RUN pnpm install --registry=https://registry.npmmirror.com
RUN npm install -g pnpm
RUN pnpm install
RUN pnpm build:docker
# run
FROM node:20-alpine
ENV APP_HOME=/app/bbs-go
WORKDIR "$APP_HOME"
COPY --from=server_builder /code/bbs-go/server/bbs-go ./server/bbs-go
COPY --from=server_builder /code/bbs-go/server/*.yaml ./server/
COPY --from=server_builder /code/bbs-go/server/*.yml ./server/
COPY --from=site_builder /code/bbs-go/site/.output ./site/.output
COPY --from=site_builder /code/bbs-go/site/node_modules ./site/node_modules
COPY --from=admin_builder /code/bbs-go/admin/dist ./server/admin
COPY ./start.sh ${APP_HOME}/start.sh
RUN chmod +x ${APP_HOME}/start.sh
EXPOSE 8082 3000
CMD ["./start.sh"]
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/happywzy/bbs-go.git
[email protected]:happywzy/bbs-go.git
happywzy
bbs-go
bbs-go
master

搜索帮助