diff --git a/Dockerfile b/Dockerfile index 2c60adc3f..ddb6584bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,11 @@ FROM golang:1.23 AS server_builder ENV APP_HOME=/code/bbs-go/server WORKDIR "$APP_HOME" -# COPY ./server/go.mod ./ -# COPY ./server/go.sum ./ COPY ./server ./ RUN go env -w GOPROXY=https://goproxy.cn,direct \ && go mod download RUN go mod download -# COPY ./server ./ RUN CGO_ENABLED=0 go build -v -o bbs-go main.go && chmod +x bbs-go @@ -23,13 +20,12 @@ 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 --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 @@ -37,6 +33,7 @@ ENV APP_HOME=/app/bbs-go WORKDIR "$APP_HOME" 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=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/ diff --git a/site/.dockerignore b/site/.dockerignore deleted file mode 100644 index 1b163ad05..000000000 --- a/site/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.output -.nuxt -node_modules -.eslintcache diff --git a/site/Dockerfile b/site/Dockerfile deleted file mode 100644 index 53538b062..000000000 --- a/site/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM node:20-alpine AS builder - -ENV APP_HOME /code/bbs-go/site -WORKDIR "$APP_HOME" - -COPY . ./ -# 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 - -FROM node:20-alpine - -COPY --from=builder /code/bbs-go/site/.output /app/bbs-go/.output - -WORKDIR /app/bbs-go - -EXPOSE 3000 - -ENV ENV=docker -CMD ["node", "./.output/server/index.mjs"] \ No newline at end of file diff --git a/start.sh b/start.sh index e46df4ac8..38c61b1e9 100755 --- a/start.sh +++ b/start.sh @@ -7,6 +7,7 @@ cd ${APP_HOME}/server ${APP_HOME}/server/bbs-go & # 启动 bbs-go-site +cd ${APP_HOME}/site node ${APP_HOME}/site/.output/server/index.mjs & # 保持容器运行