-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: arm | ||
|
||
on: | ||
push: | ||
tags: | ||
- "arm*" | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
arm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get version | ||
id: get_version | ||
run: | | ||
TIMEVERSION=$(date "+%Y%m%d-%H%M%S") | ||
echo ::set-output name=VERSION::${TIMEVERSION} | ||
- name: 展示版本 | ||
run: echo ${{ steps.get_version.outputs.VERSION }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: 打包镜像并推送 | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
build-args: | | ||
VAN_BLOG_BUILD_SERVER=https://blog-demo.mereith.com/ | ||
VAN_BLOG_VERSIONS=test-${{ steps.get_version.outputs.VERSION }} | ||
platforms: linux/arm64 | ||
push: true | ||
tags: | | ||
"docker.io/mereith/van-blog:test-${{ steps.get_version.outputs.VERSION }}" |
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 |
---|---|---|
|
@@ -28,24 +28,15 @@ RUN pnpm config set fetch-timeout 600000 -g | |
RUN pnpm i | ||
RUN pnpm build | ||
|
||
FROM node:16-alpine AS WEBSITE_DEPS | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
# RUN apk add --no-cache libc6-compat | ||
FROM node:18-alpine AS WEBSITE_BUILDER | ||
WORKDIR /app | ||
COPY ./packages/website/package.json ./packages/website/pnpm-lock.yaml* ./ | ||
RUN npm install --global [email protected] | ||
RUN pnpm config set network-timeout 600000 -g | ||
RUN pnpm config set registry https://registry.npmmirror.com -g | ||
RUN pnpm config set fetch-retries 20 -g | ||
RUN pnpm config set fetch-timeout 600000 -g | ||
# RUN yarn config set registry https://registry.npmmirror.com -g | ||
RUN pnpm i | ||
|
||
FROM node:16-alpine AS WEBSITE_BUILDER | ||
WORKDIR /app | ||
COPY --from=WEBSITE_DEPS /app/node_modules ./node_modules | ||
COPY ./packages/website/ . | ||
ENV isBuild=t | ||
COPY ./package.json ./ | ||
COPY ./pnpm-lock.yaml ./ | ||
COPY ./pnpm-workspace.yaml ./ | ||
COPY ./tsconfig.base.json ./ | ||
COPY ./lerna.json ./ | ||
COPY ./packages/website ./packages/website | ||
ENV isBuild t | ||
ENV VAN_BLOG_ALLOW_DOMAINS "pic.mereith.com" | ||
ARG VAN_BLOG_BUILD_SERVER | ||
ENV VAN_BLOG_SERVER_URL ${VAN_BLOG_BUILD_SERVER} | ||
|
@@ -56,7 +47,8 @@ RUN pnpm config set network-timeout 600000 -g | |
RUN pnpm config set registry https://registry.npmmirror.com -g | ||
RUN pnpm config set fetch-retries 20 -g | ||
RUN pnpm config set fetch-timeout 600000 -g | ||
RUN pnpm build | ||
RUN pnpm install --frozen-lockfile | ||
RUN pnpm build:website | ||
|
||
|
||
#运行容器 | ||
|
@@ -81,12 +73,12 @@ COPY --from=SERVER_BUILDER /app/node_modules ./node_modules | |
COPY --from=SERVER_BUILDER /app/dist/src/ ./ | ||
# 复制 website | ||
WORKDIR /app/website | ||
COPY --from=WEBSITE_BUILDER /app/next.config.js ./ | ||
COPY --from=WEBSITE_BUILDER /app/public ./public | ||
COPY --from=WEBSITE_BUILDER /app/package.json ./package.json | ||
COPY --from=WEBSITE_BUILDER /app/.next/standalone ./ | ||
COPY --from=WEBSITE_BUILDER /app/.next/static ./.next/static | ||
RUN cd /app/website && cd .. | ||
COPY --from=WEBSITE_BUILDER /app/packages/website/.next/standalone/ ./ | ||
COPY --from=WEBSITE_BUILDER /app/packages/website/next.config.js ./packages/website/next.config.js | ||
COPY --from=WEBSITE_BUILDER /app/packages/website/public ./packages/website/public | ||
COPY --from=WEBSITE_BUILDER /app/packages/website/package.json ./packages/website/package.json | ||
COPY --from=WEBSITE_BUILDER /app/packages/website/.next/static ./packages/website/.next/static | ||
RUN cd /app/website && cd .. | ||
ENV NODE_ENV production | ||
ENV VAN_BLOG_SERVER_URL "http://127.0.0.1:3000" | ||
ENV VAN_BLOG_ALLOW_DOMAINS "pic.mereith.com" | ||
|
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