Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobaidadada committed Nov 21, 2024
1 parent 1cd9823 commit 4e83153
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ jobs:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
- run: npm install --ignore-scripts
- run: npm run build
- if: ${{github.event.inputs.job == 'build-push'}}
run: npm publish
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
push-docker:
Expand All @@ -41,8 +40,15 @@ jobs:
DOCKER_REPO: ${{ secrets.DOCKER_USERNAME }}/filecat
DOCKER_PLATFORMS: linux/amd64,linux/arm,linux/arm64 # 目标平台
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4 # 使用社区的指令
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: |
sudo apt update
sudo apt install gcc-10 g++-10 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
- name: Docker meta # 镜像仓库
id: meta
uses: docker/metadata-action@v5
Expand All @@ -54,6 +60,10 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: build
run: |
npm install --ignore-scripts
npm run docker-build
- name: Login to Docker Hub # login to Docker Hub, automatically logout at the end of job
uses: docker/login-action@v3
with:
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:hydrogen-alpine3.20

WORKDIR /app

COPY env /app/env
COPY /build /app
#COPY /node_modules /app/node_modules
#COPY filecat-linux /app/filecat-linux
# 给 filecat-linux 添加执行权限
RUN #chmod +x /app/filecat-linux

EXPOSE 5567
ENTRYPOINT ["node","/app/main.js"]
# 默认参数 有参数会被覆盖
CMD ["--env", "/app/env"]

0 comments on commit 4e83153

Please sign in to comment.