Skip to content

Commit

Permalink
chore: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
besscroft committed Apr 20, 2024
1 parent d6b4ce3 commit 22206b1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/build-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ jobs:
- name: Get Version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm i
- name: Build Next
run: pnpm run build
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand Down
43 changes: 38 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
FROM node:18-slim AS base
FROM node:18-alpine AS base

ENV TZ="Asia/Shanghai"
FROM base AS deps

RUN apk add --no-cache libc6-compat

WORKDIR /app

COPY .output /app/.output
COPY package.json pnpm-lock.yaml ./

RUN pnpm config set registry 'https://registry.npmmirror.com/'
RUN pnpm i

FROM base AS builder

RUN apk update && apk add --no-cache git

ENV NEXT_TELEMETRY_DISABLED 1

WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
COPY ./.env ./

RUN pnpm run build

FROM base AS runner
WORKDIR /app

COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server
COPY --from=builder /app/.env ./.env

EXPOSE 3000

CMD ["node", "/app/.output/server/index.mjs"]
ENV TZ="Asia/Shanghai"

ENV PORT 3000

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD HOSTNAME="0.0.0.0" node server.js

MAINTAINER besscroft
MAINTAINER besscroft

0 comments on commit 22206b1

Please sign in to comment.